Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion network/config/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"BLOCKLIST": 0,
"ETH_IST": 0,
"VIP214": 0,
"FINALITY": 0
"FINALITY": 0,
"ETH_SH": 0
},
"accounts": [
{
Expand Down
51 changes: 51 additions & 0 deletions test/evm/compatability.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { ThorWallet } from '../../src/wallet'
import {
SimpleCounterParis__factory as ParisCounter,
SimpleCounterShanghai__factory as ShanghaiCounter,
} from '../../typechain-types'
import { pollReceipt } from '../../src/transactions'

/**
* @group opcodes
* @group evm
*/
describe('fork contract tests', () => {
const wallet: ThorWallet = ThorWallet.withFunds()

const counters = [
{
countrct: ParisCounter,
name: 'Paris',
},
{
countrct: ShanghaiCounter,
name: 'Shanghai',
},
]

counters.forEach((counter) => {
it.e2eTest(
`should be able to deploy a ${counter.name} contract`,
'all',
async () => {
const contract = await wallet.deployContract(
counter.countrct.bytecode,
counter.countrct.abi,
)

const startValue = await contract.read
.getCounter()
.then((r) => r[0])

expect(startValue).toBe(0n)
const increment = await contract.transact.incrementCounter()
await pollReceipt(increment.id)

const endValue = await contract.read
.getCounter()
.then((r) => r[0])
expect(endValue).toBe(1n)
},
)
})
})
29 changes: 10 additions & 19 deletions test/evm/individual-opcodes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,27 +544,18 @@ describe('Individual OpCodes', () => {
'should give the correct output for opcode: PUSH0',
'all',
async () => {
const clauses = [
{
data: ShanghaiCounter.bytecode,
value: '0x0',
to: null,
},
]

const tx = await wallet.sendClauses(clauses, false)

const receipt = await pollReceipt(tx.id ?? '')

expect(receipt.reverted).toBe(true)

// 0x5f is the PUSH0 opcode
const simulation = await Client.raw.executeAccountBatch({
clauses,
const debugged = await Client.raw.traceContractCall({
to: null,
data: ShanghaiCounter.bytecode,
value: '0x0',
caller,
gas: 1_000_000,
})

expect(simulation.body?.[0]?.vmError).toEqual('invalid opcode 0x5f')
expect(debugged.httpCode).toBe(200)
expect(debugged.body.failed).toBe(false)
expect(
debugged.body.structLogs.some((log: any) => log.op === 'PUSH0'),
).toBe(true)
},
)
})
28 changes: 0 additions & 28 deletions test/evm/paris/simple-paris.test.ts

This file was deleted.