-
Notifications
You must be signed in to change notification settings - Fork 649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Py evm 1466 #1799
base: main
Are you sure you want to change the base?
Py evm 1466 #1799
Conversation
I forgot to pull the upstream... my fault. Now all test passes. |
computation: BaseComputation = make_computation(chain_without_block_validation) | ||
computation.output = computation_output | ||
|
||
with mock.patch.object(SpuriousDragonComputation, 'apply_message', return_value=computation): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mock based approaches tend to be problematic. I'd prefer we test this properly using a contract that actually exceeds this limit so that we can see this fail using non-mock/real mechanisms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing related to this comment and I agree with piper here, but here's a nice article I found on mocking today written by Ned Batchelder: https://nedbatchelder.com/blog/201908/why_your_mock_doesnt_work.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries @pipermerriam and @voith, currently I am out of my town with limited connectivity, but next week I will give it another try. It will help me to have a better understanding of the code and help with more complicated task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello guys,
I am stuck for a while, I am trying to deploy a dummy contract to the chain but I am receiving a huge out of gas error. I have introduced the question on stack exchange:
The full "test" code (because I haven introduces the asserts yet) is:
@pytest.mark.parametrize('chain_without_block_validation', [MiningChain, ], indirect=True)
def test_computation_output_size_limit(chain_without_block_validation):
SENDER_PRIVATE_KEY = keys.PrivateKey(
decode_hex('0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8')
)
SENDER = Address(SENDER_PRIVATE_KEY.public_key.to_canonical_address())
state = chain_without_block_validation.get_vm().state
state.set_balance(SENDER, 1000)
vm = chain_without_block_validation.get_vm()
nonce = vm.state.get_nonce(SENDER)
vm_tx = vm.create_unsigned_transaction(
nonce=nonce,
gas_price=10,
gas=3138525,
to=CREATE_CONTRACT_ADDRESS,
value=0,
data=b'60606040523415600e57600080fd5b5b603680601c6000396000f30060606040525b600080fd00a165627a7a72305820c9e69aabe54411b89c6b2223932d7349334d3e75c12657355b7ba52c47e4db250029',
)
signed_tx = vm_tx.as_signed_transaction(SENDER_PRIVATE_KEY)
new_block, receipt, c = chain_without_block_validation.apply_transaction(signed_tx)
print("--------------------------------------------------------")
print("Computation is error: {}".format(c.is_error))
if c.is_error:
print("Computation error: {}".format(c.error))
print("computation output: {}".format(c.output))
print("computation output len: {}".format(len(c.output)))
I would appreciate any help :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dherykw how did you go about getting that deployment bytecode. My guess is that there's something wrong with it. The error you're receiving is a standard EVM error so it's probably worth you trying to trace the VM execution to figure out why it's trying to expand the memory to such a large size.
What was wrong?
EIP170 states that the contract size limit was changed to
2**14 + 2**13
which is24,576
bytes. The following line implementations the constant for EIP170, but it is off by one.Issue Reference: #1466
How was it fixed?
Contract limit size was changed by @glaksmono, I have improved the tests
To-Do
Cute Animal Picture