diff --git a/cpp/test/adapter-non-local.test.js b/cpp/test/adapter-non-local.test.js index f0eb96c..4720abe 100644 --- a/cpp/test/adapter-non-local.test.js +++ b/cpp/test/adapter-non-local.test.js @@ -23,8 +23,11 @@ const { } = require('./samples/evm-operations') const { evmMetadataSamples, teePubKey } = require('./samples/evm-metadata') const { adjustPrecision, fromWei } = require('./utils/precision-utils') +const { ProofcastEventAttestator } = require('@pnetwork/event-attestator') +const { hexToPublicKey } = require('./utils') const attestation = 'deadbeef' +const anotherAttestation = 'deadc0de' describe('Adapter EVM -> EOS testing', () => { const evmTokenSymbol = 'TST' @@ -408,8 +411,30 @@ describe('Adapter EVM -> EOS testing', () => { const tee = getSingletonInstance(adapter.contract, 'tee') + const nullKey = 'PUB_K1_11111111111111111111111111111111149Mr2R' expect(tee.key).to.be.equal(teePubKey.toString()) + expect(tee.updating_key).to.be.equal(nullKey) expect(tee.attestation).to.be.equal(attestation) + expect(tee.updating_attestation).to.be.equal('') + expect(tee.change_grace_threshold).to.be.equal(0) + }) + + it('Should wait and set a grace time period when a new tee is set', async () => { + const anotherEventAttestator = new ProofcastEventAttestator() + const anotherPublicKey = hexToPublicKey( + anotherEventAttestator.signingKey.compressedPublicKey, + ) + await adapter.contract.actions + .settee([anotherPublicKey, anotherAttestation]) + .send(active(adapter.account)) + + const tee = getSingletonInstance(adapter.contract, 'tee') + + expect(tee.key).to.be.equal(teePubKey.toString()) + expect(tee.updating_key).to.be.equal(anotherPublicKey.toString()) + expect(tee.attestation).to.be.equal(attestation) + expect(tee.updating_attestation).to.be.equal(anotherAttestation) + expect(tee.change_grace_threshold).to.not.be.equal(0) }) })