Skip to content

Commit

Permalink
tests/e2e: Unify contract makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Aug 2, 2023
1 parent 63e2510 commit 945891a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 104 deletions.
4 changes: 2 additions & 2 deletions runtime-sdk/modules/evm/src/precompile/subcall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ mod test {

/// Test contract code.
static TEST_CONTRACT_CODE_HEX: &str =
include_str!("../../../../../tests/e2e/contracts/subcall/evm_subcall_compiled.hex");
include_str!("../../../../../tests/e2e/contracts/subcall/evm_subcall.hex");
/// Test contract ABI.
static TEST_CONTRACT_ABI_JSON: &str =
include_str!("../../../../../tests/e2e/contracts/subcall/evm_subcall_abi.json");
include_str!("../../../../../tests/e2e/contracts/subcall/evm_subcall.abi");

fn init_and_deploy_contract<C: BatchContext>(ctx: &mut C, signer: &mut EvmSigner) -> H160 {
TestRuntime::migrate(ctx);
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/contracts/contracts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: $(hex)

$(hex): $(contract)
@solc $(contract) --bin --abi --optimize -o .build
@mv .build/*.abi $(abi)
@mv .build/*.bin $(hex)
@rmdir .build

.PHONY: all

10 changes: 1 addition & 9 deletions tests/e2e/contracts/rng/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@ contract = evm_rng.sol
abi = evm_rng.abi
hex = evm_rng.hex

all: $(hex)

$(hex): $(contract)
@solc $(contract) --bin --abi --optimize -o .build
@mv .build/*.abi $(abi)
@mv .build/*.bin $(hex)
@rmdir .build

.PHONY: all
include ../contracts.mk

6 changes: 6 additions & 0 deletions tests/e2e/contracts/subcall/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
contract = evm_subcall.sol
abi = evm_subcall.abi
hex = evm_subcall.hex

include ../contracts.mk

1 change: 1 addition & 0 deletions tests/e2e/contracts/subcall/evm_subcall.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"uint64","name":"code","type":"uint64"},{"internalType":"bytes","name":"module","type":"bytes"}],"name":"SubcallFailed","type":"error"},{"inputs":[{"internalType":"bytes","name":"method","type":"bytes"},{"internalType":"bytes","name":"body","type":"bytes"}],"name":"test","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"method","type":"bytes"},{"internalType":"bytes","name":"body","type":"bytes"}],"name":"test_delegatecall","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"method","type":"bytes"},{"internalType":"bytes","name":"body","type":"bytes"}],"name":"test_spin","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"}]
1 change: 1 addition & 0 deletions tests/e2e/contracts/subcall/evm_subcall.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
608060405234801561000f575f80fd5b5061062e8061001d5f395ff3fe608060405260043610610033575f3560e01c80630c5561a61461003757806323bfb16a1461006057806350d82f381461007f575b5f80fd5b61004a610045366004610377565b61009e565b604051610057919061042b565b60405180910390f35b34801561006b575f80fd5b5061004a61007a366004610377565b610162565b34801561008a575f80fd5b5061004a610099366004610377565b610212565b60605f80610102600160981b016001600160a01b0316878787876040516020016100cb9493929190610465565b60408051601f19818403018152908290526100e59161048b565b5f604051808303815f865af19150503d805f811461011e576040519150601f19603f3d011682016040523d82523d5f602084013e610123565b606091505b50915091508161014e5760405162461bcd60e51b8152600401610145906104a6565b60405180910390fd5b610157816102e1565b979650505050505050565b60605f80610102600160981b016001600160a01b03168787878760405160200161018f9493929190610465565b60408051601f19818403018152908290526101a99161048b565b5f60405180830381855af49150503d805f81146101e1576040519150601f19603f3d011682016040523d82523d5f602084013e6101e6565b606091505b5091509150816102085760405162461bcd60e51b8152600401610145906104a6565b9695505050505050565b60605f80610102600160981b016001600160a01b03168787878760405160200161023f9493929190610465565b60408051601f19818403018152908290526102599161048b565b5f604051808303815f865af19150503d805f8114610292576040519150601f19603f3d011682016040523d82523d5f602084013e610297565b606091505b5091509150816102b95760405162461bcd60e51b8152600401610145906104a6565b5f5b60648112156102d657806102ce816104ce565b9150506102bb565b509695505050505050565b60605f80838060200190518101906102f9919061050c565b915091508167ffffffffffffffff165f1461032b57818160405163575a7c4d60e01b81526004016101459291906105ce565b9392505050565b5f8083601f840112610342575f80fd5b50813567ffffffffffffffff811115610359575f80fd5b602083019150836020828501011115610370575f80fd5b9250929050565b5f805f806040858703121561038a575f80fd5b843567ffffffffffffffff808211156103a1575f80fd5b6103ad88838901610332565b909650945060208701359150808211156103c5575f80fd5b506103d287828801610332565b95989497509550505050565b5f5b838110156103f85781810151838201526020016103e0565b50505f910152565b5f81518084526104178160208601602086016103de565b601f01601f19169290920160200192915050565b602081525f61032b6020830184610400565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b604081525f61047860408301868861043d565b828103602084015261015781858761043d565b5f825161049c8184602087016103de565b9190910192915050565b6020808252600e908201526d1cdd5898d85b1b0819985a5b195960921b604082015260600190565b5f6001600160ff1b0182016104f157634e487b7160e01b5f52601160045260245ffd5b5060010190565b634e487b7160e01b5f52604160045260245ffd5b5f806040838503121561051d575f80fd5b825167ffffffffffffffff8082168214610535575f80fd5b602085015191935080821115610549575f80fd5b818501915085601f83011261055c575f80fd5b81518181111561056e5761056e6104f8565b604051601f8201601f19908116603f01168101908382118183101715610596576105966104f8565b816040528281528860208487010111156105ae575f80fd5b6105bf8360208301602088016103de565b80955050505050509250929050565b67ffffffffffffffff83168152604060208201525f6105f06040830184610400565b94935050505056fea26469706673582212200d1600b1d5aadfe166b8e12683fa33eb93b7d9b0f2c53c95a01ecb651f082a5b64736f6c63430008150033
90 changes: 0 additions & 90 deletions tests/e2e/contracts/subcall/evm_subcall_abi.json

This file was deleted.

1 change: 0 additions & 1 deletion tests/e2e/contracts/subcall/evm_subcall_compiled.hex

This file was deleted.

4 changes: 2 additions & 2 deletions tests/e2e/contracts/subcall/subcall.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// CompiledHex is the compiled subcall contract in hex encoding.
//
//go:embed evm_subcall_compiled.hex
//go:embed evm_subcall.hex
var CompiledHex string

// Compiled is the compiled subcall contract.
Expand All @@ -23,7 +23,7 @@ var Compiled = func() []byte {
return contract
}()

//go:embed evm_subcall_abi.json
//go:embed evm_subcall.abi
var evmSubcallABIJson string

// ABI is the ABI of the subcall contract.
Expand Down

0 comments on commit 945891a

Please sign in to comment.