diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a58a8da..a19d411 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -37,11 +37,3 @@ jobs:
echo "Building fixture contracts"
deno task build
-
- echo "Verifying no new files were created (bytecode should be committed)"
- if [ -n "$(git status --porcelain)" ]; then
- echo "Error: Build created new or modified files. All bytecode should be committed."
- git status
- exit 1
- fi
- echo "Success: All contract bytecode is up to date"
diff --git a/.gitignore b/.gitignore
index 529be5b..54ab843 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,11 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
+codegen/abi/*
+codegen/pvm/*
+codegen/evm/*
+*.sha256.txt
+
node_modules
dist
dist-ssr
@@ -24,3 +29,4 @@ src/samples
*.njsproj
*.sln
*.sw?
+
diff --git a/.prettierrc.json b/.prettierrc.json
deleted file mode 100644
index e74ed9f..0000000
--- a/.prettierrc.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "trailingComma": "es5",
- "tabWidth": 4,
- "semi": false,
- "singleQuote": true
-}
diff --git a/abi/Errors.json b/abi/Errors.json
deleted file mode 100644
index 22e9076..0000000
--- a/abi/Errors.json
+++ /dev/null
@@ -1,106 +0,0 @@
-[
- {
- "inputs": [
- {
- "internalType": "string",
- "name": "message",
- "type": "string"
- }
- ],
- "name": "CustomError",
- "type": "error"
- },
- {
- "inputs": [
- {
- "internalType": "bool",
- "name": "newState",
- "type": "bool"
- }
- ],
- "name": "setState",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "state",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "triggerAssertError",
- "outputs": [],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "triggerCustomError",
- "outputs": [],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "triggerDivisionByZero",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "triggerOutOfBoundsError",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "triggerRequireError",
- "outputs": [],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "triggerRevertError",
- "outputs": [],
- "stateMutability": "pure",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "valueMatch",
- "outputs": [],
- "stateMutability": "payable",
- "type": "function"
- }
-]
diff --git a/abi/Errors.ts b/abi/Errors.ts
deleted file mode 100644
index 36e8816..0000000
--- a/abi/Errors.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-export const ErrorsAbi = [
- {
- 'inputs': [
- {
- 'internalType': 'string',
- 'name': 'message',
- 'type': 'string',
- },
- ],
- 'name': 'CustomError',
- 'type': 'error',
- },
- {
- 'inputs': [
- {
- 'internalType': 'bool',
- 'name': 'newState',
- 'type': 'bool',
- },
- ],
- 'name': 'setState',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'state',
- 'outputs': [
- {
- 'internalType': 'bool',
- 'name': '',
- 'type': 'bool',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'triggerAssertError',
- 'outputs': [],
- 'stateMutability': 'pure',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'triggerCustomError',
- 'outputs': [],
- 'stateMutability': 'pure',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'triggerDivisionByZero',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'pure',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'triggerOutOfBoundsError',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'pure',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'triggerRequireError',
- 'outputs': [],
- 'stateMutability': 'pure',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'triggerRevertError',
- 'outputs': [],
- 'stateMutability': 'pure',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'value',
- 'type': 'uint256',
- },
- ],
- 'name': 'valueMatch',
- 'outputs': [],
- 'stateMutability': 'payable',
- 'type': 'function',
- },
-] as const
diff --git a/abi/EventExample.json b/abi/EventExample.json
deleted file mode 100644
index aed83c0..0000000
--- a/abi/EventExample.json
+++ /dev/null
@@ -1,34 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "sender",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "string",
- "name": "message",
- "type": "string"
- }
- ],
- "name": "ExampleEvent",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "triggerEvent",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
diff --git a/abi/EventExample.ts b/abi/EventExample.ts
deleted file mode 100644
index 66e88f9..0000000
--- a/abi/EventExample.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-export const EventExampleAbi = [
- {
- 'anonymous': false,
- 'inputs': [
- {
- 'indexed': true,
- 'internalType': 'address',
- 'name': 'sender',
- 'type': 'address',
- },
- {
- 'indexed': false,
- 'internalType': 'uint256',
- 'name': 'value',
- 'type': 'uint256',
- },
- {
- 'indexed': false,
- 'internalType': 'string',
- 'name': 'message',
- 'type': 'string',
- },
- ],
- 'name': 'ExampleEvent',
- 'type': 'event',
- },
- {
- 'inputs': [],
- 'name': 'triggerEvent',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
-] as const
diff --git a/abi/Flipper.json b/abi/Flipper.json
deleted file mode 100644
index 844fea8..0000000
--- a/abi/Flipper.json
+++ /dev/null
@@ -1,40 +0,0 @@
-[
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "inputs": [],
- "name": "flip",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getValue",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "value",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
-]
diff --git a/abi/Flipper.ts b/abi/Flipper.ts
deleted file mode 100644
index 8ef3a50..0000000
--- a/abi/Flipper.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-export const FlipperAbi = [
- {
- 'inputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'constructor',
- },
- {
- 'inputs': [],
- 'name': 'flip',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'getValue',
- 'outputs': [
- {
- 'internalType': 'bool',
- 'name': '',
- 'type': 'bool',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'value',
- 'outputs': [
- {
- 'internalType': 'bool',
- 'name': '',
- 'type': 'bool',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
-] as const
diff --git a/abi/FlipperCaller.json b/abi/FlipperCaller.json
deleted file mode 100644
index 6061ffd..0000000
--- a/abi/FlipperCaller.json
+++ /dev/null
@@ -1,46 +0,0 @@
-[
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_flipperAddress",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "inputs": [],
- "name": "callFlip",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "callGetValue",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "flipperAddress",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
-]
diff --git a/abi/FlipperCaller.ts b/abi/FlipperCaller.ts
deleted file mode 100644
index 81d2ebe..0000000
--- a/abi/FlipperCaller.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-export const FlipperCallerAbi = [
- {
- 'inputs': [
- {
- 'internalType': 'address',
- 'name': '_flipperAddress',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'nonpayable',
- 'type': 'constructor',
- },
- {
- 'inputs': [],
- 'name': 'callFlip',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'callGetValue',
- 'outputs': [
- {
- 'internalType': 'bool',
- 'name': '',
- 'type': 'bool',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'flipperAddress',
- 'outputs': [
- {
- 'internalType': 'address',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
-] as const
diff --git a/abi/PiggyBank.json b/abi/PiggyBank.json
deleted file mode 100644
index f338585..0000000
--- a/abi/PiggyBank.json
+++ /dev/null
@@ -1,65 +0,0 @@
-[
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "inputs": [],
- "name": "deposit",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getDeposit",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "withdrawAmount",
- "type": "uint256"
- }
- ],
- "name": "withdraw",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "remainingBal",
- "type": "uint256"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
diff --git a/abi/PiggyBank.ts b/abi/PiggyBank.ts
deleted file mode 100644
index 44c91f3..0000000
--- a/abi/PiggyBank.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-export const PiggyBankAbi = [
- {
- 'inputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'constructor',
- },
- {
- 'inputs': [],
- 'name': 'deposit',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'payable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'getDeposit',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'owner',
- 'outputs': [
- {
- 'internalType': 'address',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'withdrawAmount',
- 'type': 'uint256',
- },
- ],
- 'name': 'withdraw',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': 'remainingBal',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
-] as const
diff --git a/abi/PretraceFixture.json b/abi/PretraceFixture.json
deleted file mode 100644
index 1b4d466..0000000
--- a/abi/PretraceFixture.json
+++ /dev/null
@@ -1,174 +0,0 @@
-[
- {
- "inputs": [],
- "stateMutability": "payable",
- "type": "constructor"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "name": "balances",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "childAddr",
- "type": "address"
- }
- ],
- "name": "callContract",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "createChild",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "childAddr",
- "type": "address"
- }
- ],
- "name": "delegatecallContract",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "deposit",
- "outputs": [],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "getContractBalance",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- }
- ],
- "name": "getExternalBalance",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "readStorage",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "str",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "value",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "withdraw",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_value",
- "type": "uint256"
- },
- {
- "internalType": "string",
- "name": "_str",
- "type": "string"
- }
- ],
- "name": "writeStorage",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
diff --git a/abi/PretraceFixture.ts b/abi/PretraceFixture.ts
deleted file mode 100644
index 2dbea5d..0000000
--- a/abi/PretraceFixture.ts
+++ /dev/null
@@ -1,174 +0,0 @@
-export const PretraceFixtureAbi = [
- {
- 'inputs': [],
- 'stateMutability': 'payable',
- 'type': 'constructor',
- },
- {
- 'inputs': [
- {
- 'internalType': 'address',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'name': 'balances',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'address',
- 'name': 'childAddr',
- 'type': 'address',
- },
- ],
- 'name': 'callContract',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'createChild',
- 'outputs': [
- {
- 'internalType': 'address',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'address',
- 'name': 'childAddr',
- 'type': 'address',
- },
- ],
- 'name': 'delegatecallContract',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'deposit',
- 'outputs': [],
- 'stateMutability': 'payable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'getContractBalance',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'address',
- 'name': 'account',
- 'type': 'address',
- },
- ],
- 'name': 'getExternalBalance',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'readStorage',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'str',
- 'outputs': [
- {
- 'internalType': 'string',
- 'name': '',
- 'type': 'string',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'value',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'amount',
- 'type': 'uint256',
- },
- ],
- 'name': 'withdraw',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': '_value',
- 'type': 'uint256',
- },
- {
- 'internalType': 'string',
- 'name': '_str',
- 'type': 'string',
- },
- ],
- 'name': 'writeStorage',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
-] as const
diff --git a/abi/PretraceFixtureChild.json b/abi/PretraceFixtureChild.json
deleted file mode 100644
index a002fe8..0000000
--- a/abi/PretraceFixtureChild.json
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
- "inputs": [],
- "name": "increment",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "value",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
-]
diff --git a/abi/PretraceFixtureChild.ts b/abi/PretraceFixtureChild.ts
deleted file mode 100644
index 32b6741..0000000
--- a/abi/PretraceFixtureChild.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-export const PretraceFixtureChildAbi = [
- {
- 'inputs': [],
- 'name': 'increment',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'value',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
-] as const
diff --git a/abi/Storage.json b/abi/Storage.json
deleted file mode 100644
index 1e97d0b..0000000
--- a/abi/Storage.json
+++ /dev/null
@@ -1,59 +0,0 @@
-[
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "inputs": [],
- "name": "n1",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "n2",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "num",
- "type": "uint256"
- }
- ],
- "name": "write_n1_read_n2",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "num",
- "type": "uint256"
- }
- ],
- "name": "write_n2",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
diff --git a/abi/Storage.ts b/abi/Storage.ts
deleted file mode 100644
index 13875d6..0000000
--- a/abi/Storage.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-export const StorageAbi = [
- {
- 'inputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'constructor',
- },
- {
- 'inputs': [],
- 'name': 'n1',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'n2',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'num',
- 'type': 'uint256',
- },
- ],
- 'name': 'write_n1_read_n2',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'num',
- 'type': 'uint256',
- },
- ],
- 'name': 'write_n2',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
-] as const
diff --git a/abi/Tester.json b/abi/Tester.json
deleted file mode 100644
index 1c2cb13..0000000
--- a/abi/Tester.json
+++ /dev/null
@@ -1,72 +0,0 @@
-[
- {
- "inputs": [],
- "stateMutability": "payable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "creator",
- "type": "address"
- }
- ],
- "name": "TesterDeployed",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "name",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "string",
- "name": "v",
- "type": "string"
- }
- ],
- "name": "setName",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "v",
- "type": "uint256"
- }
- ],
- "name": "setValue",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "value",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
-]
diff --git a/abi/Tester.ts b/abi/Tester.ts
deleted file mode 100644
index 4b3e7ed..0000000
--- a/abi/Tester.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-export const TesterAbi = [
- {
- 'inputs': [],
- 'stateMutability': 'payable',
- 'type': 'constructor',
- },
- {
- 'anonymous': false,
- 'inputs': [
- {
- 'indexed': true,
- 'internalType': 'address',
- 'name': 'creator',
- 'type': 'address',
- },
- ],
- 'name': 'TesterDeployed',
- 'type': 'event',
- },
- {
- 'inputs': [],
- 'name': 'name',
- 'outputs': [
- {
- 'internalType': 'string',
- 'name': '',
- 'type': 'string',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'string',
- 'name': 'v',
- 'type': 'string',
- },
- ],
- 'name': 'setName',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'v',
- 'type': 'uint256',
- },
- ],
- 'name': 'setValue',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'value',
- 'outputs': [
- {
- 'internalType': 'uint256',
- 'name': '',
- 'type': 'uint256',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
-] as const
diff --git a/abi/TracingCallee.json b/abi/TracingCallee.json
deleted file mode 100644
index 16a5abf..0000000
--- a/abi/TracingCallee.json
+++ /dev/null
@@ -1,39 +0,0 @@
-[
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "counter",
- "type": "uint256"
- }
- ],
- "name": "CalleeCalled",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "counter",
- "type": "uint256"
- }
- ],
- "name": "consumeGas",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "failingFunction",
- "outputs": [],
- "stateMutability": "payable",
- "type": "function"
- },
- {
- "stateMutability": "payable",
- "type": "receive"
- }
-]
diff --git a/abi/TracingCallee.ts b/abi/TracingCallee.ts
deleted file mode 100644
index cdb3018..0000000
--- a/abi/TracingCallee.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-export const TracingCalleeAbi = [
- {
- 'anonymous': false,
- 'inputs': [
- {
- 'indexed': false,
- 'internalType': 'uint256',
- 'name': 'counter',
- 'type': 'uint256',
- },
- ],
- 'name': 'CalleeCalled',
- 'type': 'event',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'counter',
- 'type': 'uint256',
- },
- ],
- 'name': 'consumeGas',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'failingFunction',
- 'outputs': [],
- 'stateMutability': 'payable',
- 'type': 'function',
- },
- {
- 'stateMutability': 'payable',
- 'type': 'receive',
- },
-] as const
diff --git a/abi/TracingCaller.json b/abi/TracingCaller.json
deleted file mode 100644
index f43c4bd..0000000
--- a/abi/TracingCaller.json
+++ /dev/null
@@ -1,84 +0,0 @@
-[
- {
- "inputs": [
- {
- "internalType": "address payable",
- "name": "_callee",
- "type": "address"
- }
- ],
- "stateMutability": "payable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "string",
- "name": "message",
- "type": "string"
- }
- ],
- "name": "TraceEvent",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "callee",
- "outputs": [
- {
- "internalType": "address payable",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "create",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "create2",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "counter",
- "type": "uint256"
- }
- ],
- "name": "start",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
-]
diff --git a/abi/TracingCaller.ts b/abi/TracingCaller.ts
deleted file mode 100644
index c494048..0000000
--- a/abi/TracingCaller.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-export const TracingCallerAbi = [
- {
- 'inputs': [
- {
- 'internalType': 'address payable',
- 'name': '_callee',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'payable',
- 'type': 'constructor',
- },
- {
- 'anonymous': false,
- 'inputs': [
- {
- 'indexed': false,
- 'internalType': 'uint256',
- 'name': 'value',
- 'type': 'uint256',
- },
- {
- 'indexed': false,
- 'internalType': 'string',
- 'name': 'message',
- 'type': 'string',
- },
- ],
- 'name': 'TraceEvent',
- 'type': 'event',
- },
- {
- 'inputs': [],
- 'name': 'callee',
- 'outputs': [
- {
- 'internalType': 'address payable',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'view',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'create',
- 'outputs': [
- {
- 'internalType': 'address',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [],
- 'name': 'create2',
- 'outputs': [
- {
- 'internalType': 'address',
- 'name': '',
- 'type': 'address',
- },
- ],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
- {
- 'inputs': [
- {
- 'internalType': 'uint256',
- 'name': 'counter',
- 'type': 'uint256',
- },
- ],
- 'name': 'start',
- 'outputs': [],
- 'stateMutability': 'nonpayable',
- 'type': 'function',
- },
-] as const
diff --git a/abi/.gitkeep b/codegen/abi/.gitkeep
similarity index 100%
rename from abi/.gitkeep
rename to codegen/abi/.gitkeep
diff --git a/evm/.gitkeep b/codegen/evm/.gitkeep
similarity index 100%
rename from evm/.gitkeep
rename to codegen/evm/.gitkeep
diff --git a/pvm/.gitkeep b/codegen/pvm/.gitkeep
similarity index 100%
rename from pvm/.gitkeep
rename to codegen/pvm/.gitkeep
diff --git a/deno.json b/deno.json
index 46c0e3d..8b302fa 100644
--- a/deno.json
+++ b/deno.json
@@ -9,9 +9,9 @@
}
},
"tasks": {
- "build": "deno run -P src/build-contracts.ts && deno fmt",
- "test:evm": "USE_REVIVE=evm START_REVIVE_DEV_NODE=true START_ETH_RPC=true deno test -P",
- "test:pvm": "USE_REVIVE=pvm START_REVIVE_DEV_NODE=true START_ETH_RPC=true deno test -P",
+ "build": "deno run -P src/build-contracts.ts",
+ "test:evm": "deno task build && USE_REVIVE=evm START_REVIVE_DEV_NODE=true START_ETH_RPC=true deno test -P",
+ "test:pvm": "deno task build && USE_REVIVE=pvm START_REVIVE_DEV_NODE=true START_ETH_RPC=true deno test -P",
"test:geth": "START_GETH=true deno test -P",
"lint": "deno fmt --check && deno lint"
},
@@ -19,14 +19,16 @@
"include": ["src/all-tests.ts"]
},
"imports": {
- "viem": "npm:viem@^2.38.0",
- "viem/": "npm:/viem@^2.38.0/",
- "solc": "npm:solc@^0.8.28",
- "@parity/resolc": "npm:@parity/resolc@^0.2.0",
- "@std/assert": "jsr:@std/assert@^1",
- "@std/expect": "jsr:@std/expect@^1",
- "@std/testing": "jsr:@std/testing@^1",
- "@std/path": "jsr:@std/path@^1"
+ "@std/cli": "jsr:@std/cli@^1.0.23",
+ "viem": "npm:viem@^2.38.3",
+ "viem/": "npm:/viem@^2.38.3/",
+ "solc": "npm:solc@^0.8.30",
+ "@parity/resolc": "npm:@parity/resolc@^0.4.1",
+ "@std/assert": "jsr:@std/assert@^1.0.15",
+ "@std/expect": "jsr:@std/expect@^1.0.17",
+ "@std/testing": "jsr:@std/testing@^1.0.16",
+ "@std/path": "jsr:@std/path@^1.1.2",
+ "@std/log": "jsr:@std/log@^0.224"
},
"compilerOptions": {
"strict": true
diff --git a/deno.lock b/deno.lock
index 089d735..8e56f46 100644
--- a/deno.lock
+++ b/deno.lock
@@ -1,21 +1,25 @@
{
"version": "5",
"specifiers": {
- "jsr:@std/assert@1": "1.0.15",
"jsr:@std/assert@^1.0.14": "1.0.15",
"jsr:@std/assert@^1.0.15": "1.0.15",
- "jsr:@std/expect@1": "1.0.17",
+ "jsr:@std/cli@^1.0.23": "1.0.23",
+ "jsr:@std/data-structures@^1.0.9": "1.0.9",
+ "jsr:@std/expect@^1.0.17": "1.0.17",
+ "jsr:@std/fmt@^1.0.5": "1.0.8",
+ "jsr:@std/fs@^1.0.11": "1.0.19",
"jsr:@std/fs@^1.0.19": "1.0.19",
"jsr:@std/internal@^1.0.10": "1.0.12",
"jsr:@std/internal@^1.0.12": "1.0.12",
- "jsr:@std/path@1": "1.1.2",
+ "jsr:@std/io@~0.225.2": "0.225.2",
+ "jsr:@std/log@0.224": "0.224.14",
"jsr:@std/path@^1.1.1": "1.1.2",
"jsr:@std/path@^1.1.2": "1.1.2",
- "jsr:@std/testing@1": "1.0.16",
- "npm:@parity/resolc@0.2": "0.2.0",
+ "jsr:@std/testing@^1.0.16": "1.0.16",
+ "npm:@parity/resolc@~0.4.1": "0.4.1",
"npm:@types/node@*": "24.2.0",
- "npm:solc@~0.8.28": "0.8.30",
- "npm:viem@^2.38.0": "2.38.0_ws@8.18.3"
+ "npm:solc@~0.8.30": "0.8.30",
+ "npm:viem@^2.38.3": "2.38.3_ws@8.18.3"
},
"jsr": {
"@std/assert@1.0.15": {
@@ -24,6 +28,15 @@
"jsr:@std/internal@^1.0.12"
]
},
+ "@std/cli@1.0.23": {
+ "integrity": "bf95b7a9425ba2af1ae5a6359daf58c508f2decf711a76ed2993cd352498ccca",
+ "dependencies": [
+ "jsr:@std/internal@^1.0.12"
+ ]
+ },
+ "@std/data-structures@1.0.9": {
+ "integrity": "033d6e17e64bf1f84a614e647c1b015fa2576ae3312305821e1a4cb20674bb4d"
+ },
"@std/expect@1.0.17": {
"integrity": "316b47dd65c33e3151344eb3267bf42efba17d1415425f07ed96185d67fc04d9",
"dependencies": [
@@ -31,6 +44,9 @@
"jsr:@std/internal@^1.0.10"
]
},
+ "@std/fmt@1.0.8": {
+ "integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7"
+ },
"@std/fs@1.0.19": {
"integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06",
"dependencies": [
@@ -40,6 +56,17 @@
"@std/internal@1.0.12": {
"integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027"
},
+ "@std/io@0.225.2": {
+ "integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7"
+ },
+ "@std/log@0.224.14": {
+ "integrity": "257f7adceee3b53bb2bc86c7242e7d1bc59729e57d4981c4a7e5b876c808f05e",
+ "dependencies": [
+ "jsr:@std/fmt",
+ "jsr:@std/fs@^1.0.11",
+ "jsr:@std/io"
+ ]
+ },
"@std/path@1.1.2": {
"integrity": "c0b13b97dfe06546d5e16bf3966b1cadf92e1cc83e56ba5476ad8b498d9e3038",
"dependencies": [
@@ -50,7 +77,8 @@
"integrity": "a917ffdeb5924c9be436dc78bc32e511760e14d3a96e49c607fc5ecca86d0092",
"dependencies": [
"jsr:@std/assert@^1.0.15",
- "jsr:@std/fs",
+ "jsr:@std/data-structures",
+ "jsr:@std/fs@^1.0.19",
"jsr:@std/internal@^1.0.12",
"jsr:@std/path@^1.1.2"
]
@@ -72,10 +100,10 @@
"@noble/hashes@1.8.0": {
"integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A=="
},
- "@parity/resolc@0.2.0": {
- "integrity": "sha512-5IGnWNzLNj/5unM61aIFKUXbvveqMmhiz/tPX0W3w434flDDOwfU5ER8hls1F9o9I79l0N00D83ZTkcWjyJhUQ==",
+ "@parity/resolc@0.4.1": {
+ "integrity": "sha512-GdeJnCVlnRrrHjQk0vr+8mmkiJ2LiLwe7CEQBSKslHqK3t7dhjJORR1kfxoksTM4LSyftHUYmPszeIY0r1pv3w==",
"dependencies": [
- "@types/node@22.18.10",
+ "@types/node@22.18.11",
"commander@13.1.0",
"package-json",
"resolve-pkg",
@@ -118,8 +146,8 @@
"@scure/base"
]
},
- "@types/node@22.18.10": {
- "integrity": "sha512-anNG/V/Efn/YZY4pRzbACnKxNKoBng2VTFydVu8RRs5hQjikP8CQfaeAV59VFSCzKNp90mXiVXW2QzV56rwMrg==",
+ "@types/node@22.18.11": {
+ "integrity": "sha512-Gd33J2XIrXurb+eT2ktze3rJAfAp9ZNjlBdh4SVgyrKEOADwCbdUDaK7QgJno8Ue4kcajscsKqu6n8OBG3hhCQ==",
"dependencies": [
"undici-types@6.21.0"
]
@@ -173,8 +201,8 @@
"js-sha3@0.8.0": {
"integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q=="
},
- "ky@1.11.0": {
- "integrity": "sha512-NEyo0ICpS0cqSuyoJFMCnHOZJILqXsKhIZlHJGDYaH8OB5IFrGzuBpEwyoMZG6gUKMPrazH30Ax5XKaujvD8ag=="
+ "ky@1.12.0": {
+ "integrity": "sha512-YRLmSUHCwOJRBMArtqMRLOmO7fewn3yOoui6aB8ERkRVXupa0UiaQaKbIXteMt4jUElhbdqTMsLFHs8APxxUoQ=="
},
"memorystream@0.3.1": {
"integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw=="
@@ -277,8 +305,8 @@
"undici-types@7.10.0": {
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag=="
},
- "viem@2.38.0_ws@8.18.3": {
- "integrity": "sha512-YU5TG8dgBNeYPrCMww0u9/JVeq2ZCk9fzk6QybrPkBooFysamHXL1zC3ua10aLPt9iWoA/gSVf1D9w7nc5B1aA==",
+ "viem@2.38.3_ws@8.18.3": {
+ "integrity": "sha512-By2TutLv07iNHHtWqHHzjGipevYsfGqT7KQbGEmqLco1qTJxKnvBbSviqiu6/v/9REV6Q/FpmIxf2Z7/l5AbcQ==",
"dependencies": [
"@noble/curves",
"@noble/hashes",
@@ -296,13 +324,15 @@
},
"workspace": {
"dependencies": [
- "jsr:@std/assert@1",
- "jsr:@std/expect@1",
- "jsr:@std/path@1",
- "jsr:@std/testing@1",
- "npm:@parity/resolc@0.2",
- "npm:solc@~0.8.28",
- "npm:viem@^2.38.0"
+ "jsr:@std/assert@^1.0.15",
+ "jsr:@std/cli@^1.0.23",
+ "jsr:@std/expect@^1.0.17",
+ "jsr:@std/log@0.224",
+ "jsr:@std/path@^1.1.2",
+ "jsr:@std/testing@^1.0.16",
+ "npm:@parity/resolc@~0.4.1",
+ "npm:solc@~0.8.30",
+ "npm:viem@^2.38.3"
]
}
}
diff --git a/evm/Errors.bin b/evm/Errors.bin
deleted file mode 100644
index 2d17f69..0000000
Binary files a/evm/Errors.bin and /dev/null differ
diff --git a/evm/EventExample.bin b/evm/EventExample.bin
deleted file mode 100644
index 3f3274e..0000000
Binary files a/evm/EventExample.bin and /dev/null differ
diff --git a/evm/Flipper.bin b/evm/Flipper.bin
deleted file mode 100644
index bb043d7..0000000
Binary files a/evm/Flipper.bin and /dev/null differ
diff --git a/evm/FlipperCaller.bin b/evm/FlipperCaller.bin
deleted file mode 100644
index b31ee15..0000000
Binary files a/evm/FlipperCaller.bin and /dev/null differ
diff --git a/evm/PretraceFixture.bin b/evm/PretraceFixture.bin
deleted file mode 100644
index 492961a..0000000
Binary files a/evm/PretraceFixture.bin and /dev/null differ
diff --git a/evm/PretraceFixtureChild.bin b/evm/PretraceFixtureChild.bin
deleted file mode 100644
index e8bb622..0000000
Binary files a/evm/PretraceFixtureChild.bin and /dev/null differ
diff --git a/evm/Tester.bin b/evm/Tester.bin
deleted file mode 100644
index dfa0cb1..0000000
Binary files a/evm/Tester.bin and /dev/null differ
diff --git a/evm/TracingCallee.bin b/evm/TracingCallee.bin
deleted file mode 100644
index d485015..0000000
Binary files a/evm/TracingCallee.bin and /dev/null differ
diff --git a/evm/TracingCaller.bin b/evm/TracingCaller.bin
deleted file mode 100644
index 42007d2..0000000
Binary files a/evm/TracingCaller.bin and /dev/null differ
diff --git a/pvm/Errors.polkavm b/pvm/Errors.polkavm
deleted file mode 100644
index 336f3ff..0000000
Binary files a/pvm/Errors.polkavm and /dev/null differ
diff --git a/pvm/EventExample.polkavm b/pvm/EventExample.polkavm
deleted file mode 100644
index 33703d2..0000000
Binary files a/pvm/EventExample.polkavm and /dev/null differ
diff --git a/pvm/Flipper.polkavm b/pvm/Flipper.polkavm
deleted file mode 100644
index d2d9753..0000000
Binary files a/pvm/Flipper.polkavm and /dev/null differ
diff --git a/pvm/FlipperCaller.polkavm b/pvm/FlipperCaller.polkavm
deleted file mode 100644
index 87f4d9e..0000000
Binary files a/pvm/FlipperCaller.polkavm and /dev/null differ
diff --git a/pvm/PiggyBank.polkavm b/pvm/PiggyBank.polkavm
deleted file mode 100644
index f501efa..0000000
Binary files a/pvm/PiggyBank.polkavm and /dev/null differ
diff --git a/pvm/PretraceFixture.polkavm b/pvm/PretraceFixture.polkavm
deleted file mode 100644
index 780ec04..0000000
Binary files a/pvm/PretraceFixture.polkavm and /dev/null differ
diff --git a/pvm/PretraceFixtureChild.polkavm b/pvm/PretraceFixtureChild.polkavm
deleted file mode 100644
index 40c7036..0000000
Binary files a/pvm/PretraceFixtureChild.polkavm and /dev/null differ
diff --git a/pvm/Storage.polkavm b/pvm/Storage.polkavm
deleted file mode 100644
index d587442..0000000
Binary files a/pvm/Storage.polkavm and /dev/null differ
diff --git a/pvm/Tester.polkavm b/pvm/Tester.polkavm
deleted file mode 100644
index fb92e9c..0000000
Binary files a/pvm/Tester.polkavm and /dev/null differ
diff --git a/pvm/TracingCallee.polkavm b/pvm/TracingCallee.polkavm
deleted file mode 100644
index c8d7383..0000000
Binary files a/pvm/TracingCallee.polkavm and /dev/null differ
diff --git a/pvm/TracingCaller.polkavm b/pvm/TracingCaller.polkavm
deleted file mode 100644
index c614839..0000000
Binary files a/pvm/TracingCaller.polkavm and /dev/null differ
diff --git a/revive_chain.metadata b/revive_chain.metadata
deleted file mode 100644
index 5b41455..0000000
Binary files a/revive_chain.metadata and /dev/null differ
diff --git a/src/build-contracts.ts b/src/build-contracts.ts
index e548fa9..7672e40 100644
--- a/src/build-contracts.ts
+++ b/src/build-contracts.ts
@@ -1,18 +1,82 @@
///
-import { compile, type SolcOutput, tryResolveImport } from '@parity/resolc'
+import * as resolc from '@parity/resolc'
import solc from 'solc'
import { basename, join } from '@std/path'
+import * as log from '@std/log'
+import { parseArgs } from '@std/cli'
+
+type CompileInput = Parameters[0]
+const LOG_LEVEL = (Deno.env.get('LOG_LEVEL')?.toUpperCase() ??
+ 'INFO') as log.LevelName
+log.setup({
+ handlers: {
+ console: new log.ConsoleHandler(LOG_LEVEL),
+ },
+ loggers: {
+ default: {
+ level: LOG_LEVEL,
+ handlers: ['console'],
+ },
+ },
+})
+
+const logger = log.getLogger()
+const { filter, solcOnly, force } = parseArgs(Deno.args, {
+ string: ['filter'],
+ boolean: ['solcOnly', 'force'],
+})
+
+async function computeSha256(content: string): Promise {
+ const encoder = new TextEncoder()
+ const data = encoder.encode(content)
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data)
+ const hashArray = Array.from(new Uint8Array(hashBuffer))
+ return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')
+}
+
+function readCachedHash(hashFile: string): string | null {
+ try {
+ return Deno.readTextFileSync(hashFile).trim()
+ } catch {
+ return null
+ }
+}
-type CompileInput = Parameters[0]
+function writeCachedHash(hashFile: string, hash: string): void {
+ Deno.writeTextFileSync(hashFile, hash)
+}
-const args = Deno.args
-const filter = args.includes('-f') || args.includes('--filter')
- ? args[args.indexOf('-f') + 1] || args[args.indexOf('--filter') + 1]
- : undefined
-const solcOnly = args.includes('-s') || args.includes('--solcOnly')
+let resolcVersion = ''
+async function pvmCompile(file: Deno.DirEntry, sources: CompileInput) {
+ if (resolcVersion === '') {
+ if (Deno.env.get('REVIVE_BIN') === undefined) {
+ resolcVersion = ` @parity/resolc: ${resolc.version().trim()}`
+ } else {
+ resolcVersion = new TextDecoder()
+ .decode(
+ (
+ await new Deno.Command('resolc', {
+ args: ['--version'],
+ stdout: 'piped',
+ }).output()
+ ).stdout,
+ )
+ .trim()
+ }
+ }
+ logger.info(`Compiling ${file.name} with revive ${resolcVersion}`)
+ return await resolc.compile(sources, {
+ bin: Deno.env.get('REVIVE_BIN'),
+ })
+}
-function evmCompile(sources: CompileInput) {
+let solcVersion = ''
+function evmCompile(file: Deno.DirEntry, sources: CompileInput) {
+ if (solcVersion === '') {
+ solcVersion = solc.version()
+ }
+ logger.info(`Compile ${file.name} with solc ${solcVersion}`)
const input = {
language: 'Solidity',
sources,
@@ -27,101 +91,116 @@ function evmCompile(sources: CompileInput) {
return solc.compile(JSON.stringify(input), {
import: (relativePath: string) => {
- const source = Deno.readTextFileSync(tryResolveImport(relativePath))
+ const source = Deno.readTextFileSync(
+ resolc.tryResolveImport(relativePath),
+ )
return { contents: source }
},
})
}
-console.log('Compiling contracts...')
+logger.debug('Compiling contracts...')
const currentDir = new URL('.', import.meta.url).pathname
const rootDir = join(currentDir, '..')
const contractsDir = join(rootDir, 'contracts')
-const abiDir = join(rootDir, 'abi')
-const pvmDir = join(rootDir, 'pvm')
-const evmDir = join(rootDir, 'evm')
+const codegenDir = join(rootDir, 'codegen')
+const abiDir = join(codegenDir, 'abi')
+const pvmDir = join(codegenDir, 'pvm')
+const evmDir = join(codegenDir, 'evm')
const input = Array.from(Deno.readDirSync(contractsDir))
.filter((f) => f.isFile && f.name.endsWith('.sol'))
.filter((f) => !filter || f.name.includes(filter))
for (const file of input) {
- console.log(`🔨 Compiling ${file.name}...`)
const name = basename(file.name)
+ const sourceFilePath = join(contractsDir, file.name)
+ const sourceContent = Deno.readTextFileSync(sourceFilePath)
+ const sourceHash = await computeSha256(sourceContent)
const inputSources = {
[name]: {
- content: Deno.readTextFileSync(join(contractsDir, file.name)),
+ content: sourceContent,
},
}
- if (!solcOnly) {
- if (Deno.env.get('REVIVE_BIN') === undefined) {
- console.log('Compiling with revive...')
- } else {
- console.log(
- `Compiling with revive (using ${
- Deno.env.get('REVIVE_BIN')
- })...`,
- )
- }
- const reviveOut = await compile(inputSources, {
- bin: Deno.env.get('REVIVE_BIN'),
- })
+ // Create marker files to track if this source has been compiled
+ const pvmSourceMarkerFile = join(pvmDir, `.${name}.sha256.txt`)
+ const pvmSourceMarkerHash = readCachedHash(pvmSourceMarkerFile)
+ const needsPvmCompilation = !solcOnly &&
+ (force || pvmSourceMarkerHash !== sourceHash)
+
+ const evmSourceMarkerFile = join(evmDir, `.${name}.sha256.txt`)
+ const evmSourceMarkerHash = readCachedHash(evmSourceMarkerFile)
+ const needsEvmCompilation = force || evmSourceMarkerHash !== sourceHash
+
+ if (needsPvmCompilation) {
+ const reviveOut = await pvmCompile(file, inputSources)
for (const contracts of Object.values(reviveOut.contracts)) {
for (const [name, contract] of Object.entries(contracts)) {
if (contract?.evm?.bytecode?.object) {
- console.log(`📜 Add PVM contract ${name}`)
+ const pvmFile = join(pvmDir, `${name}.polkavm`)
+ logger.info(`📜 Add PVM contract ${name}`)
const bytecode = new Uint8Array(
contract.evm.bytecode.object
.match(/.{1,2}/g)!
.map((byte) => parseInt(byte, 16)),
)
- Deno.writeFileSync(
- join(pvmDir, `${name}.polkavm`),
- bytecode,
- )
+ Deno.writeFileSync(pvmFile, bytecode)
}
}
}
+ writeCachedHash(pvmSourceMarkerFile, sourceHash)
+ } else if (!solcOnly) {
+ logger.debug(
+ `⏭️ Skipping PVM compilation for ${file.name} (unchanged)`,
+ )
+ }
+
+ if (!needsEvmCompilation) {
+ logger.debug(
+ `⏭️ Skipping EVM compilation for ${file.name} (unchanged)`,
+ )
+ continue
}
- console.log(`Compile with solc ${file.name}`)
- const evmOut = JSON.parse(evmCompile(inputSources)) as SolcOutput
+ const evmOut = JSON.parse(
+ evmCompile(file, inputSources),
+ ) as resolc.SolcOutput
if (evmOut.errors) {
for (const error of evmOut.errors) {
- console.error(error.formattedMessage)
+ logger.error(error.formattedMessage)
+ }
+
+ if (evmOut.errors.some((err) => err.severity !== 'warning')) {
+ Deno.exit(1)
}
- Deno.exit(1)
}
for (const contracts of Object.values(evmOut.contracts)) {
for (const [name, contract] of Object.entries(contracts)) {
- console.log(`📜 Add EVM contract ${name}`)
+ const evmFile = join(evmDir, `${name}.bin`)
+ const abiFile = join(abiDir, `${name}.ts`)
// Only write bytecode if it exists and is not empty
if (contract.evm?.bytecode?.object) {
const bytecodeHex = contract.evm.bytecode.object
if (bytecodeHex.length > 0) {
+ logger.info(`📜 Add EVM contract ${name}`)
const bytecode = new Uint8Array(
bytecodeHex
.match(/.{1,2}/g)!
.map((byte) => parseInt(byte, 16)),
)
- Deno.writeFileSync(join(evmDir, `${name}.bin`), bytecode)
+ Deno.writeFileSync(evmFile, bytecode)
}
}
+ logger.info(`📜 Add ABI ${name}`)
const abi = contract.abi
const abiName = `${name}Abi`
- Deno.writeTextFileSync(
- join(abiDir, `${name}.json`),
- JSON.stringify(abi, null, 2),
- )
-
- // Format TypeScript file manually (simple formatting)
const tsContent = `export const ${abiName} = ${
JSON.stringify(
abi,
@@ -129,7 +208,14 @@ for (const file of input) {
2,
)
} as const\n`
- Deno.writeTextFileSync(join(abiDir, `${name}.ts`), tsContent)
+ Deno.writeTextFileSync(abiFile, tsContent)
}
}
+
+ // Mark that we've compiled this source file for EVM
+ writeCachedHash(evmSourceMarkerFile, sourceHash)
+
+ if (needsEvmCompilation || needsPvmCompilation) {
+ logger.info(`✅ Compiled ${file.name} successfully`)
+ }
}
diff --git a/src/errors.test.ts b/src/errors.test.ts
index f60bee4..c8d7330 100644
--- a/src/errors.test.ts
+++ b/src/errors.test.ts
@@ -6,7 +6,7 @@ import {
sanitizeOpts as opts,
} from './util.ts'
import { expect } from '@std/expect'
-import { ErrorsAbi } from '../abi/Errors.ts'
+import { ErrorsAbi } from '../codegen/abi/Errors.ts'
// Initialize test environment
const env = await getEnv()
diff --git a/src/methods.test.ts b/src/methods.test.ts
index 2e6d8b3..44e8bc2 100644
--- a/src/methods.test.ts
+++ b/src/methods.test.ts
@@ -12,7 +12,7 @@ import {
sanitizeOpts as opts,
} from './util.ts'
import { expect } from '@std/expect'
-import { TesterAbi } from '../abi/Tester.ts'
+import { TesterAbi } from '../codegen/abi/Tester.ts'
// Initialize test environment
const env = await getEnv()
@@ -80,7 +80,7 @@ Deno.test('eth_getBalance', opts, async () => {
expect(balance).toEqual(parseEther('2'))
})
-Deno.test('eth_getBlockByHash and eth_getBlockByNumber', opts, async () => {
+Deno.test('eth_getBlockBy', opts, async () => {
const { blockNumber, blockHash } = await getTesterReceipt()
const by_number = await env.serverWallet.getBlock({
blockNumber,
@@ -93,23 +93,24 @@ Deno.test('eth_getBlockByHash and eth_getBlockByNumber', opts, async () => {
expect(by_hash).toEqual(by_number)
})
-Deno.test(
- 'eth_getBlockTransactionCountByHash and eth_getBlockTransactionCountByNumber',
- opts,
- async () => {
- const { blockNumber, blockHash } = await getTesterReceipt()
- const byNumber = await env.serverWallet.getBlockTransactionCount({
+Deno.test('eth_getBlockTransactionCount', opts, async (t) => {
+ const { blockNumber, blockHash } = await getTesterReceipt()
+
+ await t.step('ByNumber', async () => {
+ const count = await env.serverWallet.getBlockTransactionCount({
blockNumber,
})
+ expect(count).toBeGreaterThanOrEqual(1)
+ })
- const byHash = await env.serverWallet.getBlockTransactionCount({
+ await t.step('ByHash', async () => {
+ const count = await env.serverWallet.getBlockTransactionCount({
blockHash,
})
- expect(byNumber).toEqual(byHash)
- expect(byNumber).toBeGreaterThanOrEqual(1)
- },
-)
+ expect(count).toBeGreaterThanOrEqual(1)
+ })
+})
Deno.test('eth_getCode', opts, async () => {
// Existing contract
@@ -176,30 +177,33 @@ Deno.test('eth_getStorageAt', opts, async () => {
)
})
-Deno.test(
- 'get_transaction_by_block_hash_and_index, eth_getTransactionByBlockNumberAndIndex and eth_getTransactionByHash',
- opts,
- async () => {
- const {
- transactionHash: hash,
- blockHash,
- transactionIndex: index,
- blockNumber,
- } = await getTesterReceipt()
- const byTxHash = await env.serverWallet.getTransaction({ hash })
- expect(byTxHash).toBeTruthy()
+Deno.test('eth_getTransactionBy', opts, async (t) => {
+ const {
+ transactionHash: hash,
+ blockHash,
+ transactionIndex: index,
+ blockNumber,
+ } = await getTesterReceipt()
+
+ const byTxHash = await env.serverWallet.getTransaction({ hash })
+ t.step('eth_getTransactionByHash', () => expect(byTxHash).toBeTruthy())
+
+ await t.step('get_transaction_by_block_hash_and_index', async () => {
const byBlockHash = await env.serverWallet.getTransaction({
blockHash,
index,
})
expect(byBlockHash).toEqual(byTxHash)
+ })
+
+ await t.step('eth_getTransactionByBlockNumberAndIndex', async () => {
const byBlockNumber = await env.serverWallet.getTransaction({
blockNumber,
index,
})
expect(byBlockNumber).toEqual(byTxHash)
- },
-)
+ })
+})
Deno.test('eth_getTransactionCount', opts, async () => {
const count = await env.serverWallet.getTransactionCount(
diff --git a/src/others.test.ts b/src/others.test.ts
index 23ad972..fa00cc0 100644
--- a/src/others.test.ts
+++ b/src/others.test.ts
@@ -7,8 +7,8 @@ import {
} from './util.ts'
import { expect } from '@std/expect'
import { decodeEventLog, encodeFunctionData, parseEther } from 'viem'
-import { ErrorsAbi } from '../abi/Errors.ts'
-import { EventExampleAbi } from '../abi/EventExample.ts'
+import { ErrorsAbi } from '../codegen/abi/Errors.ts'
+import { EventExampleAbi } from '../codegen/abi/EventExample.ts'
// Initialize test environment
const env = await getEnv()
diff --git a/src/solc.d.ts b/src/solc.d.ts
index c5e18cb..26fba28 100644
--- a/src/solc.d.ts
+++ b/src/solc.d.ts
@@ -75,6 +75,8 @@ declare module 'solc' {
}
}
+ export function version(): string
+
// Main exported functions
export function compile(
input: string | CompileInput,
diff --git a/src/spammer.ts b/src/spammer.ts
index 335ef71..eccaee0 100644
--- a/src/spammer.ts
+++ b/src/spammer.ts
@@ -5,7 +5,7 @@ import {
wait,
waitForHealth,
} from './util.ts'
-import { FlipperAbi } from '../abi/Flipper.ts'
+import { FlipperAbi } from '../codegen/abi/Flipper.ts'
if (Deno.env.get('START_REVIVE_DEV_NODE')) {
const nodePath = Deno.env.get('REVIVE_DEV_NODE_PATH') ??
diff --git a/src/tracing-call-trace.test.ts b/src/tracing-call-trace.test.ts
index ea66b22..30ecfc3 100644
--- a/src/tracing-call-trace.test.ts
+++ b/src/tracing-call-trace.test.ts
@@ -10,8 +10,8 @@ import {
import { assertSnapshot } from '@std/testing/snapshot'
import { expect } from '@std/expect'
import { encodeFunctionData, parseEther } from 'viem'
-import { TracingCallerAbi } from '../abi/TracingCaller.ts'
-import { TracingCalleeAbi } from '../abi/TracingCallee.ts'
+import { TracingCallerAbi } from '../codegen/abi/TracingCaller.ts'
+import { TracingCalleeAbi } from '../codegen/abi/TracingCallee.ts'
// Initialize test environment
const env = await getEnv()
diff --git a/src/tracing-prestate.test.ts b/src/tracing-prestate.test.ts
index 8c20b81..dba0024 100644
--- a/src/tracing-prestate.test.ts
+++ b/src/tracing-prestate.test.ts
@@ -12,8 +12,8 @@ import {
import { assertSnapshot } from '@std/testing/snapshot'
import { expect } from '@std/expect'
import { encodeFunctionData, type Hex, parseEther } from 'viem'
-import { PretraceFixtureAbi } from '../abi/PretraceFixture.ts'
-import { PretraceFixtureChildAbi } from '../abi/PretraceFixtureChild.ts'
+import { PretraceFixtureAbi } from '../codegen/abi/PretraceFixture.ts'
+import { PretraceFixtureChildAbi } from '../codegen/abi/PretraceFixtureChild.ts'
// Initialize test environment
const env = await getEnv()
diff --git a/src/util.ts b/src/util.ts
index ef88419..50de3dc 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -25,8 +25,8 @@ export const sanitizeOpts = {
export function getByteCode(name: string, evm: boolean): Hex {
const bytecode = evm
- ? Deno.readFileSync(`evm/${name}.bin`)
- : Deno.readFileSync(`pvm/${name}.polkavm`)
+ ? Deno.readFileSync(`codegen/evm/${name}.bin`)
+ : Deno.readFileSync(`codegen/pvm/${name}.polkavm`)
return `0x${
Array.from(bytecode)
.map((b: number) => b.toString(16).padStart(2, '0'))