Skip to content

Commit

Permalink
test(adapter): check settee cooldown period setup
Browse files Browse the repository at this point in the history
  • Loading branch information
envin3 committed Nov 9, 2024
1 parent 8170078 commit a44bab3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cpp/test/adapter-non-local.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
})
})

Expand Down

0 comments on commit a44bab3

Please sign in to comment.