Skip to content

Add Events Tests

Add Events Tests #414

GitHub Actions / E2E Test Report succeeded Aug 29, 2024 in 1s

339 passed, 0 failed and 1 skipped

Tests passed successfully

✅ junit.xml

340 tests were completed in 241s with 339 passed, 0 failed and 1 skipped.

Test suite Passed Failed Skipped Time
test/evm/eth-opcodes.test.ts 3✅ 20s
test/evm/individual-opcodes.test.ts 103✅ 19s
test/evm/paris/simple-paris.test.ts 1✅ 21s
test/thorest-api/accounts/contracts.test.ts 7✅ 89s
test/thorest-api/accounts/execute-codes.test.ts 13✅ 31s
test/thorest-api/accounts/get-account-code.test.ts 22✅ 18s
test/thorest-api/accounts/get-account-storage.test.ts 10✅ 31s
test/thorest-api/accounts/get-accounts.test.ts 15✅ 11s
test/thorest-api/blocks/get-blocks.test.ts 14✅ 1⚪ 1s
test/thorest-api/debug/tracers-call.test.ts 29✅ 12s
test/thorest-api/debug/tracers.test.ts 18✅ 1s
test/thorest-api/logs/query-events.test.ts 28✅ 31s
test/thorest-api/logs/query-transfers.test.ts 26✅ 20s
test/thorest-api/node/get-peers.test.ts 1✅ 101ms
test/thorest-api/subscriptions/ws-beat.test.ts 4✅ 39s
test/thorest-api/subscriptions/ws-beat2.test.ts 4✅ 40s
test/thorest-api/subscriptions/ws-blocks.test.ts 1✅ 20s
test/thorest-api/subscriptions/ws-events.test.ts 11✅ 69s
test/thorest-api/subscriptions/ws-transfers.test.ts 11✅ 67s
test/thorest-api/subscriptions/ws-tx-pool.test.ts 1✅ 11s
test/thorest-api/transactions/delegated-tx.test.ts 1✅ 20s
test/thorest-api/transactions/dependant-transaction.test.ts 1✅ 19s
test/thorest-api/transactions/get-transaction-receipt.test.ts 1✅ 1s
test/thorest-api/transactions/get-transaction.test.ts 1✅ 1s
test/thorest-api/transactions/post-transaction.test.ts 2✅ 9s
test/thorest-api/transactions/post-tx-with-clauses.test.ts 1✅ 10s
test/thorest-api/transactions/send-tx-not-enough-gas.test.ts 4✅ 13s
test/thorest-api/transactions/vet-transfer.test.ts 6✅ 78s

✅ test/evm/eth-opcodes.test.ts

EVM Opcodes
  ✅ should run without errors the majority of opcodes
  ✅ should throw invalid op code
  ✅ should revert

✅ test/evm/individual-opcodes.test.ts

Individual OpCodes
  ✅ should give the correct output for opcode: ADD
  ✅ should give the correct output for opcode: MUL
  ✅ should give the correct output for opcode: SUB
  ✅ should give the correct output for opcode: DIV
  ✅ should give the correct output for opcode: SDIV
  ✅ should give the correct output for opcode: MOD
  ✅ should give the correct output for opcode: SMOD
  ✅ should give the correct output for opcode: ADDMOD
  ✅ should give the correct output for opcode: MULMOD
  ✅ should give the correct output for opcode: EXP
  ✅ should give the correct output for opcode: SIGNEXTEND
  ✅ should give the correct output for opcode: LT
  ✅ should give the correct output for opcode: GT
  ✅ should give the correct output for opcode: SLT
  ✅ should give the correct output for opcode: SGT
  ✅ should give the correct output for opcode: EQ
  ✅ should give the correct output for opcode: ISZERO
  ✅ should give the correct output for opcode: AND
  ✅ should give the correct output for opcode: OR
  ✅ should give the correct output for opcode: XOR
  ✅ should give the correct output for opcode: NOT
  ✅ should give the correct output for opcode: BYTE
  ✅ should give the correct output for opcode: SHL
  ✅ should give the correct output for opcode: SHR
  ✅ should give the correct output for opcode: SAR
  ✅ should give the correct output for opcode: SHA3
  ✅ should give the correct output for opcode: ORIGIN
  ✅ should give the correct output for opcode: CALLER
  ✅ should give the correct output for opcode: CALLVALUE
  ✅ should give the correct output for opcode: CALLDATALOAD
  ✅ should give the correct output for opcode: CALLDATASIZE
  ✅ should give the correct output for opcode: CALLDATACOPY
  ✅ should give the correct output for opcode: CODESIZE
  ✅ should give the correct output for opcode: CODECOPY
  ✅ should give the correct output for opcode: PUSH1
  ✅ should give the correct output for opcode: PUSH2
  ✅ should give the correct output for opcode: PUSH3
  ✅ should give the correct output for opcode: PUSH4
  ✅ should give the correct output for opcode: PUSH5
  ✅ should give the correct output for opcode: PUSH6
  ✅ should give the correct output for opcode: PUSH7
  ✅ should give the correct output for opcode: PUSH8
  ✅ should give the correct output for opcode: PUSH9
  ✅ should give the correct output for opcode: PUSH10
  ✅ should give the correct output for opcode: PUSH11
  ✅ should give the correct output for opcode: PUSH12
  ✅ should give the correct output for opcode: PUSH13
  ✅ should give the correct output for opcode: PUSH14
  ✅ should give the correct output for opcode: PUSH15
  ✅ should give the correct output for opcode: PUSH16
  ✅ should give the correct output for opcode: PUSH17
  ✅ should give the correct output for opcode: PUSH18
  ✅ should give the correct output for opcode: PUSH19
  ✅ should give the correct output for opcode: PUSH20
  ✅ should give the correct output for opcode: PUSH21
  ✅ should give the correct output for opcode: PUSH22
  ✅ should give the correct output for opcode: PUSH23
  ✅ should give the correct output for opcode: PUSH24
  ✅ should give the correct output for opcode: PUSH25
  ✅ should give the correct output for opcode: PUSH26
  ✅ should give the correct output for opcode: PUSH27
  ✅ should give the correct output for opcode: PUSH28
  ✅ should give the correct output for opcode: PUSH29
  ✅ should give the correct output for opcode: PUSH30
  ✅ should give the correct output for opcode: PUSH31
  ✅ should give the correct output for opcode: PUSH32
  ✅ should give the correct output for opcode: CREATE
  ✅ should give the correct output for opcode: CALL
  ✅ should give the correct output for opcode: CALLCODE
  ✅ should give the correct output for opcode: RETURN
  ✅ should give the correct output for opcode: DELEGATECALL
  ✅ should give the correct output for opcode: CREATE2
  ✅ should give the correct output for opcode: STATICCALL
  ✅ should give the correct output for opcode: SELFDESTRUCT
  ✅ should give the correct output for opcode: BALANCE
  ✅ should give the correct output for opcode: DUP1
  ✅ should give the correct output for opcode: DUP2
  ✅ should give the correct output for opcode: DUP3
  ✅ should give the correct output for opcode: DUP4
  ✅ should give the correct output for opcode: DUP5
  ✅ should give the correct output for opcode: DUP6
  ✅ should give the correct output for opcode: DUP7
  ✅ should give the correct output for opcode: DUP8
  ✅ should give the correct output for opcode: DUP9
  ✅ should give the correct output for opcode: DUP10
  ✅ should give the correct output for opcode: DUP11
  ✅ should give the correct output for opcode: DUP12
  ✅ should give the correct output for opcode: DUP13
  ✅ should give the correct output for opcode: DUP14
  ✅ should give the correct output for opcode: DUP15
  ✅ should give the correct output for opcode: DUP16
  ✅ should give the correct output for opcode: LOG0
  ✅ should give the correct output for opcode: LOG1
  ✅ should give the correct output for opcode: LOG2
  ✅ should give the correct output for opcode: LOG3
  ✅ should give the correct output for opcode: LOG4
  ✅ should give the correct output for opcode: REVERT
  ✅ should give the correct output for opcode: BASEFEE
  ✅ should give the correct output for opcode: INVALID
  ✅ should give the correct output for opcode: STOP
  ✅ should give the correct output for opcode: ADDRESS
  ✅ should give the correct output for opcode: PUSH0
  ✅ should be possible to deploy contract starting with 0xEF

✅ test/evm/paris/simple-paris.test.ts

Simple Paris
  ✅ should be able to deploy a paris contract

✅ test/thorest-api/accounts/contracts.test.ts

Contracts
  ✅ should be able to deploy a contract and verify it
  ✅ should be able to interact with a deployed smart contract
  ✅ should be able to execute multiple clauses in a single transaction
  ✅ clause updates should impact subsequent clauses
  ✅ should be able send a clause to an account with no bytecode
  ✅ should be able to send a clause to a contract that does not have the method
  ✅ should not be able to send invalid parameters to a contract

✅ test/thorest-api/accounts/execute-codes.test.ts

POST /accounts/*
  ✅ should execute an array of clauses
  ✅ should be able to query historic revisions
  ✅ should be able to call read only contract methods
  ✅ should be able to call read only contract methods with valid revision: best
  ✅ should be able to call read only contract methods with valid revision: 1
  ✅ should be able to call read only contract methods with valid revision: 0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de
  ✅ 'valid revisions not found: 123412341
  ✅ 'valid revisions not found: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b42a
  ✅ should estimate correctly for the next block
POST /accounts/* =>> execute with evm fields
  ✅ should return the correct block ref
  ✅ should return the correct gas payer
  ✅ should return the correct proved work
  ✅ should return the correct expiration

✅ test/thorest-api/accounts/get-account-code.test.ts

GET /accounts/{address}/code
  ✅ should return no code for newly created address: 0xf6ba3aefef13619321cbce5963ae76c3fdb8779e
  ✅ should return no code for newly created address: 0xc0747148ff2d2a51dca7dddfc6e3f9b0708d6f74
  ✅ should return no code for newly created address: 0x010ea0a47d3b314bc204bf230970a5abfbaff336
  ✅ should return no code for newly created address: 0xa2ea5c612243701b67e4ef0cffd4ccdeb89ae011
  ✅ should return the code for 0000000000000000000000417574686f72697479
  ✅ should return the code for 0000000000000000000000000000456e65726779
  ✅ should return the code for 0000000000000000000000457874656E73696F6e
  ✅ should return the code for 0000000000000000000000000000506172616D73
  ✅ should return the code for 0000000000000000000000004578656375746f72
  ✅ should return 400 for invalid address: bad address
  ✅ should return 400 for invalid address: 0x0001234
  ✅ should return 400 for invalid address: 0
  ✅ should return 400 for invalid address: false
  ✅ should be able to query historic revisions
  ✅ should be able to fetch the account state for revision: best
  ✅ should be able to fetch the account state for revision: 1
  ✅ should be able to fetch the account state for revision: 0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de
  ✅ should throw an error for invalid revision: bestest
  ✅ should throw an error for invalid revision: finalised
  ✅ should throw an error for invalid revision: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869bZZZ
  ✅ should throw an error for invalid revision: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b
  ✅ should throw an error for invalid revision: 0x

✅ test/thorest-api/accounts/get-account-storage.test.ts

GET /accounts/{address}/storage
  ✅ should return the storage value
  ✅ should be able to query history storage values
  ✅ valid revision best
  ✅ valid revision 1
  ✅ valid revision 0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de
  ✅ invalid revision bestest
  ✅ invalid revision finalised
  ✅ invalid revision 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869bZZZ
  ✅ invalid revision 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b
  ✅ invalid revision 0x

✅ test/thorest-api/accounts/get-accounts.test.ts

GET /accounts/{address}
  ✅ correct balance
  ✅ contract account hasCode
  ✅ valid revision best
  ✅ valid revision 1
  ✅ valid revision 0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de
  ✅ valid revision finalized
  ✅ invalid address: 0x00000000
  ✅ invalid address: zzzzzzz
  ✅ invalid address: 0x7567d83b7b8d80addcb281a71d54fc7b3364ffeZ
  ✅ invalid address: 0x7567d83b7b8d80addcb281a71d54fc7b3364ffe
  ✅ invalid revision: bestest
  ✅ invalid revision: finalised
  ✅ invalid revision: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869bZZZ
  ✅ invalid revision: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b
  ✅ invalid revision: 0x

✅ test/thorest-api/blocks/get-blocks.test.ts

GET /blocks/{revision}
  ✅ gas limit is equal to 40_000_000
  ⚪ gas limit is equal to 10_000_000
  ✅ valid revision best
  ✅ valid revision 1
  ✅ valid revision 0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de
  ✅ valid revision finalized
  ✅ valid revision not found: 123412341
  ✅ valid revision not found: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b42a
  ✅ invalid revision: bestest
  ✅ invalid revision: finalised
  ✅ invalid revision: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869bZZZ
  ✅ invalid revision: 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b
  ✅ invalid revision: 0x
  ✅ should be able get compressed blocks
  ✅ should be able get expanded blocks

✅ test/thorest-api/debug/tracers-call.test.ts

POST /debug/tracers/call
  ✅ should return 403 for no tracer
  ✅ should return 200 for tracer: opcount
  ✅ should return 200 for tracer: evmdis
  ✅ should return 200 for tracer: trigram
  ✅ should return 200 for tracer: bigram
  ✅ should return 200 for tracer: unigram
  ✅ should return 200 for tracer: 4byte
  ✅ should return 200 for tracer: call
  ✅ should return 200 for tracer: prestate
  ✅ should return 200 for tracer: noop
  ✅ should return 403 for empty body
  ✅ should return 200 for contract deployment
  ✅ should return 403 for bad tracer name
  ✅ should return 403 for empty body
  ✅ should return 200 with revision best
  ✅ should return 200 with revision 1
  ✅ should return 200 with revision 0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de
  ✅ should return 200 with revision finalized
  ✅ should return 404 with revision bestest
  ✅ should return 404 with revision finalised
  ✅ should return 404 with revision 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869bZZZ
  ✅ should return 404 with revision 0x00000000b4d1257f314d7b3f6720f99853bef846fa0a3d4873a2e1f5f869b
  ✅ should return 404 with revision 0x
  ✅ should return the correct provedWork
  ✅ should return the correct blockRef
  ✅ should return the correct gasPayer
  ✅ should return the correct expiration
  ✅ should be able to get the gasPrice
  ✅ should revert for extremely low gas

✅ test/thorest-api/debug/tracers.test.ts

POST /debug/tracers
  ✅ should return 200 for logger tracer
  ✅ should return 403 for no tracer
  ✅ should return 200 for tracer: opcount
  ✅ should return 200 for tracer: evmdis
  ✅ should return 200 for tracer: trigram
  ✅ should return 200 for tracer: bigram
  ✅ should return 200 for tracer: unigram
  ✅ should return 200 for tracer: 4byte
  ✅ should return 200 for tracer: call
  ✅ should return 200 for tracer: prestate
  ✅ should return 200 for tracer: noop
  ✅ should return 403 for empty body
  ✅ should return 403 for bad tracer name
  ✅ should return 403 for empty body
  ✅ should return bad target
  ✅ should return 403 for bad target (clause index out of bounds)
  ✅ should return 403 for bad target (tx index out of bounds)
  ✅ should be able pass config

✅ test/thorest-api/logs/query-events.test.ts

POST /logs/event
  ✅ should find a log with all parameters set
  ✅ should be able to omit all the parameters
POST /logs/event =>> query by "range"
  ✅ should be able to omit the "from" field
  ✅ should be able to omit the "to" field
  ✅ should be omit the "unit" field
  ✅ should be able query by time
  ✅ should be able query by block
  ✅ should be able to set the range to null
POST /logs/event =>> query by "order"
  ✅ events should be ordered by DESC
  ✅ events should be ordered by ASC
  ✅ default should be asc
  ✅ should be able to set the order to null
POST /logs/event =>> query by "options"
  ✅ should be able omit all the options
  ✅ should be able to omit the "offset" field
  ✅ should be able to omit the "limit" field
  ✅ should have default maximum of 1000
  ✅ should have no minimum "limit"
  ✅ should be able paginate requests
  ✅ should be empty when pagination exceeds the total amount
POST /logs/event =>> query by "criteriaSet"
  ✅ should be able query by contract address
  ✅ should be able query by topic0 address
  ✅ should be able query by topic1
  ✅ should be able query by topic2
  ✅ should be able query by topic3
  ✅ should be able query by all topics
  ✅ should be able query by all topics and address
  ✅ should be empty for matching topics and non-matching address
  ✅ should be empty for non-matching topics and matching address

✅ test/thorest-api/logs/query-transfers.test.ts

POST /logs/transfers
  ✅ should find a log with all parameters set
  ✅ should be able to omit all the parameters
POST /logs/transfers =>> query by "range"
  ✅ should be able set the range to null
  ✅ should be able to omit the "from" field
  ✅ should be able to omit the "to" field
  ✅ should be omit the "unit" field
  ✅ should be able query by time
  ✅ should be able query by block
POST /logs/transfers =>> query by "options"
  ✅ should be able omit all the options
  ✅ should be able to omit the "offset" field
  ✅ should be able to omit the "limit" field
  ✅ should have default maximum of 1000
  ✅ should have no minimum "limit"
  ✅ should be able paginate requests
POST /logs/transfers =>> query by "criteriaSet"
  ✅ should be able query by "sender"
  ✅ should be able query by "recipient"
  ✅ should be able query by "txOrigin"
  ✅ should be able query by "sender" and "recipient"
  ✅ should be able query by "sender" and "txOrigin"
  ✅ should be able query by "recipient" and "txOrigin"
  ✅ should be able query by all criteria
  ✅ should be able to omit the "criteriaSet" field
POST /logs/transfers =>> query by "order"
  ✅ events should be ordered by DESC
  ✅ events should be ordered by ASC
  ✅ default should be asc
  ✅ default should be asc

✅ test/thorest-api/node/get-peers.test.ts

GET /node/network/peers
  ✅ should get peers

✅ test/thorest-api/subscriptions/ws-beat.test.ts

WS /subscriptions/beat
  ✅ should be able to subscribe
  ✅ should be able to retrieve blocks after the current best block when providing no position parameter
  ✅ should be able to retrieve 5 blocks in order
  ✅ should be able to get block A via api call and compare it with subscription result to check they are the same

✅ test/thorest-api/subscriptions/ws-beat2.test.ts

WS /subscriptions/beat2
  ✅ should be able to subscribe
  ✅ should be able to retrieve blocks after the current best block when providing no position parameter
  ✅ should be able to retrieve 5 blocks in order
  ✅ should be able to get block A via api call and compare it with subscription result to check they are the same

✅ test/thorest-api/subscriptions/ws-blocks.test.ts

WS /subscriptions/blocks
  ✅ should be able to subscribe

✅ test/thorest-api/subscriptions/ws-events.test.ts

WS /subscriptions/event
  ✅ should work for empty parameters
  ✅ should work for valid t0
  ✅ should work for valid t1
  ✅ should work for valid t2
  ✅ should work for valid addr
  ✅ should work for valid position
  ✅ should get 2 notifications
  ✅ should error for invalid position
  ✅ should error for out of range position
  ✅ should error for invalid topic
  ✅ should error for invalid address

✅ test/thorest-api/subscriptions/ws-transfers.test.ts

WS /subscriptions/transfer
  ✅ should work for valid recipient
  ✅ should work for valid position
  ✅ should work for valid sender
  ✅ should work for valid txOrigin
  ✅ should work for valid txOrigin different than sender
  ✅ should get 2 notifications
  ✅ should error for invalid position
  ✅ should error for out of range position
  ✅ should error for invalid recipient
  ✅ should error for invalid txOrigin
  ✅ should error for invalid sender

✅ test/thorest-api/subscriptions/ws-tx-pool.test.ts

WS /subscriptions/txpool
  ✅ should be able to subscribe

✅ test/thorest-api/transactions/delegated-tx.test.ts

✅ should send a tx with delegated payer

✅ test/thorest-api/transactions/dependant-transaction.test.ts

dependant transaction
  ✅ should succeed when sending two transactions where the second one is dependant on the first one

✅ test/thorest-api/transactions/get-transaction-receipt.test.ts

GET /transactions/{id}/receipt
  ✅ should get transaction receipt

✅ test/thorest-api/transactions/get-transaction.test.ts

GET /transactions/{id}
  ✅ should get a transaction

✅ test/thorest-api/transactions/post-transaction.test.ts

POST /transactions
  ✅ should send a transaction
  ✅ transaction should fail, wrong chain id

✅ test/thorest-api/transactions/post-tx-with-clauses.test.ts

Send transaction with clauses
  ✅ clauses list is empty

✅ test/thorest-api/transactions/send-tx-not-enough-gas.test.ts

send tx with not enough gas
  ✅ should fail when making a contract deployment
  ✅ should fail when making a VET transfer
  ✅ should fail when making a contract call
  ✅ failed to transfer VTHO

✅ test/thorest-api/transactions/vet-transfer.test.ts

VET transfer, positive outcome
  ✅ transfer VET amount from address A to address B
  ✅ send multiple clauses
VET transfer, negative outcome
  ✅ multiple clauses, not enough funds
  ✅ multiple clauses, first fails
  ✅ multiple clauses, second fails
  ✅ multiple clauses, second lacks gas