def test_abi_encode_single_real(): assert abi.encode_single(['real', '128x128', []], 1.125) == (b'\x00' * 15 + b'\x01\x20' + b'\x00' * 15) assert abi.encode_single(['real', '128x128', []], -1.125) == (b'\xff' * 15 + b'\xfe' + b'\xe0' + b'\x00' * 15)
def test_abi_encode_single_ureal(): assert abi.encode_single(['ureal', '128x128', []], 0) == (b'\x00' * 32) assert abi.encode_single(['ureal', '128x128', []], 1.125) == (b'\x00' * 15 + b'\x01\x20' + b'\x00' * 15) assert abi.encode_single(['ureal', '128x128', []], 2**127 - 1) == (b'\x7f' + b'\xff' * 15 + b'\x00' * 16)
def test_abi_decode_single_bytes(): typ = ['bytes', '8', []] assert (b'\x01\x02' + b'\x00' * 6) == abi.decode_single( typ, abi.encode_single(typ, b'\x01\x02')) typ = ['bytes', '', []] assert b'\x01\x02' == abi.decode_single( typ, abi.encode_single(typ, b'\x01\x02'))
def test_encode_decode_bytes(): bytes8 = ('bytes', '8', []) dynamic_bytes = ('bytes', '', []) assert decode_single(bytes8, encode_single( bytes8, b'\x01\x02')) == (b'\x01\x02' + b'\x00' * 6) assert decode_single(dynamic_bytes, encode_single(dynamic_bytes, b'\x01\x02')) == b'\x01\x02'
def test_abi_decode_single_real(): real_data = abi.encode_single(['real', '128x128', []], 1) assert abi.decode_single(['real', '128x128', []], real_data) == 1 real_data = abi.encode_single(['real', '128x128', []], 2**127-1) assert abi.decode_single(['real', '128x128', []], real_data) == (2**127-1)*1.0 real_data = abi.encode_single(['real', '128x128', []], -1) assert abi.decode_single(['real', '128x128', []], real_data) == -1 real_data = abi.encode_single(['real', '128x128', []], -2**127) assert abi.decode_single(['real', '128x128', []], real_data) == -2**127
def test_encode_dynamic_string(): string = ('string', '', []) uint256 = ('uint', '256', []) a = u'ã' a_utf8 = a.encode('utf8') with pytest.raises(ValueError): encode_single(string, a.encode('latin')) a_encoded = encode_single(uint256, len(a_utf8)) + rzpad(a_utf8, 32) assert encode_single(string, a.encode('utf8')) == a_encoded
def test_abi_decode_single_real(): real_data = abi.encode_single(['real', '128x128', []], 1) assert abi.decode_single(['real', '128x128', []], real_data) == 1 real_data = abi.encode_single(['real', '128x128', []], 2**127 - 1) assert abi.decode_single(['real', '128x128', []], real_data) == (2**127 - 1) * 1.0 real_data = abi.encode_single(['real', '128x128', []], -1) assert abi.decode_single(['real', '128x128', []], real_data) == -1 real_data = abi.encode_single(['real', '128x128', []], -2**127) assert abi.decode_single(['real', '128x128', []], real_data) == -2**127
def test_abi_decode_single_fixed(): fixed_data = abi.encode_single(['fixed', '128x128', []], 1) assert abi.decode_single(['fixed', '128x128', []], fixed_data) == 1 fixed_data = abi.encode_single(['fixed', '128x128', []], 2**127 - 1) assert abi.decode_single(['fixed', '128x128', []], fixed_data) == (2**127 - 1) * 1.0 fixed_data = abi.encode_single(['fixed', '128x128', []], -1) assert abi.decode_single(['fixed', '128x128', []], fixed_data) == -1 fixed_data = abi.encode_single(['fixed', '128x128', []], -2**127) assert abi.decode_single(['fixed', '128x128', []], fixed_data) == -2**127
def test_encode_decode_fixed(): fixed128x128 = ('fixed', '128x128', []) fixed_data = encode_single(fixed128x128, 1) assert decode_single(fixed128x128, fixed_data) == 1 fixed_data = encode_single(fixed128x128, 2**127 - 1) assert decode_single(fixed128x128, fixed_data) == (2**127 - 1) * 1.0 fixed_data = encode_single(fixed128x128, -1) assert decode_single(fixed128x128, fixed_data) == -1 fixed_data = encode_single(fixed128x128, -2**127) assert decode_single(fixed128x128, fixed_data) == -2**127
def ethereum_event(eventid, eventabi, eventdata, contract_address): event_types = [ param['type'] for param in eventabi['inputs'] ] event_data = [ eventdata[param['name']] for param in eventabi['inputs'] if not param['indexed'] ] event_topics = [eventid] + [ encode_single(param['type'], eventdata[param['name']]) for param in eventabi['inputs'] if param['indexed'] ] event_data = encode_abi(event_types, event_data) event = { 'topics': event_topics, 'data': event_data, 'address': contract_address, } return event
def test_execution_of_call_with_single_bytes32(deploy_client, deployed_contracts, deploy_coinbase, deploy_future_block_call): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call(client_contract.setBytes32) value = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' signature = call.registerData.encoded_abi_signature data = abi.encode_single(abi.process_type('bytes32'), value) txn_data = ''.join((utils.encode_hex(signature), utils.encode_hex(data))) data_txn_hash = deploy_client.send_transaction( to=call._meta.address, data=txn_data, ) data_txn_receipt = deploy_client.wait_for_transaction(data_txn_hash) assert client_contract.v_bytes32() is None call_txn_hash = call.execute() deploy_client.wait_for_transaction(call_txn_hash) assert client_contract.v_bytes32() == value
def test_execution_of_call_with_many_values(deploy_client, deployed_contracts, deploy_coinbase, deploy_future_block_call, CallLib): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call(client_contract.setMany) values = ( 1234567890, -1234567890, 987654321, '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13', 'd3cda913deb6f67967b99d67acdfa1712c293601', 'abcdefg', ) types = ( 'uint256', 'int256', 'uint256', 'bytes20', 'address', 'bytes', ) signature = call.registerData.encoded_abi_signature data = ''.join(( abi.encode_single(abi.process_type(t), v) for t, v in zip(types, values) )) txn_data = ''.join((utils.encode_hex(signature), utils.encode_hex(data))) data_txn_hash = deploy_client.send_transaction( to=call._meta.address, data=txn_data, ) data_txn_receipt = deploy_client.wait_for_transaction(data_txn_hash) assert client_contract.vm_a() == 0 assert client_contract.vm_b() == 0 assert client_contract.vm_c() == 0 assert client_contract.vm_d() == None assert client_contract.vm_e() == '0x0000000000000000000000000000000000000000' assert client_contract.vm_f() == '' call_txn_hash = call.execute() txn_r = deploy_client.wait_for_transaction(call_txn_hash) call_logs = CallLib.CallExecuted.get_transaction_logs(call_txn_hash) call_data = [CallLib.CallExecuted.get_log_data(l) for l in call_logs] assert client_contract.vm_a() == values[0] assert client_contract.vm_b() == values[1] assert client_contract.vm_c() == values[2] assert client_contract.vm_d() == values[3] assert client_contract.vm_e() == '0xd3cda913deb6f67967b99d67acdfa1712c293601' assert client_contract.vm_f() == values[5]
def test_encode_decode_int(): int8 = ('int', '8', []) int32 = ('int', '32', []) int256 = ('int', '256', []) int8_values = [ 1, -1, 127, -128, ] int32_values = [ 1, -1, 127, -128, 2**31 - 1, -2**31, ] int256_values = [ 1, -1, 127, -128, 2**31 - 1, -2**31, 2**255 - 1, -2**255, ] for value in int8_values: assert encode_abi(['int8'], [value]) == encode_single(int8, value) assert decode_abi(['int8'], encode_abi(['int8'], [value]))[0] == value for value in int32_values: assert encode_abi(['int32'], [value]) == encode_single(int32, value) assert decode_abi(['int32'], encode_abi(['int32'], [value]))[0] == value for value in int256_values: assert encode_abi(['int256'], [value]) == encode_single(int256, value) assert decode_abi(['int256'], encode_abi(['int256'], [value]))[0] == value
def test_encode_bool(): bool_ = ('bool', '', []) uint8 = ('uint', '8', []) assert encode_single(bool_, True) == zpad(b'\x01', 32) assert encode_single(bool_, False) == zpad(b'\x00', 32) assert encode_single(bool_, True) == encode_single(uint8, 1) assert encode_single(bool_, False) == encode_single(uint8, 0)
def test_execution_of_call_with_single_uint(deploy_client, deployed_contracts, deploy_future_block_call): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call( client_contract.setUInt, call_data=abi.encode_single(abi.process_type('uint256'), 1234567890), ) deploy_client.wait_for_block(call.targetBlock()) assert client_contract.v_uint() == 0 call_txn_hash = call.execute() call_txn_receipt = deploy_client.wait_for_transaction(call_txn_hash) assert client_contract.v_uint() == 1234567890
def test_abi_encode_single_int(): assert abi.encode_single(['int', '256', []], -2**255) == (b'\x80'+b'\x00'*31) assert abi.encode_single(['int', '256', []], (b'\x80'+b'\x00'*31)) == (b'\x80'+b'\x00'*31) assert abi.encode_single(['int', '8', []], -128) == zpad(b'\x80', 32) with pytest.raises(abi.ValueOutOfBounds): assert abi.encode_single(['int', '8', []], -129) assert abi.encode_single(['int', '8', []], 127) == zpad(b'\x7f', 32) with pytest.raises(abi.ValueOutOfBounds): assert abi.encode_single(['int', '8', []], 128)
def test_encoded_ufixed(): ufixed128x128 = ('ufixed', '128x128', []) _2_125 = decode_hex(b'00000000000000000000000000000002' b'20000000000000000000000000000000') _8_5 = decode_hex(b'00000000000000000000000000000008' b'80000000000000000000000000000000') assert encode_single(ufixed128x128, 2.125) == _2_125 assert encode_single(ufixed128x128, 8.5) == _8_5 assert encode_single(ufixed128x128, 0) == (b'\x00' * 32) assert encode_single(ufixed128x128, 1.125) == (b'\x00' * 15 + b'\x01\x20' + b'\x00' * 15) assert encode_single(ufixed128x128, 2**127 - 1) == (b'\x7f' + b'\xff' * 15 + b'\x00' * 16) with pytest.raises(ValueOutOfBounds): encode_single(ufixed128x128, 2**128 + 1) with pytest.raises(ValueOutOfBounds): encode_single(ufixed128x128, -1)
def test_execution_of_call_with_single_address(deploy_client, deployed_contracts, deploy_coinbase, deploy_future_block_call): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call( client_contract.setAddress, call_data=abi.encode_single(abi.process_type('address'), deploy_coinbase[2:]), ) deploy_client.wait_for_block(call.targetBlock()) assert client_contract.v_address() == '0x0000000000000000000000000000000000000000' call_txn_hash = call.execute() call_txn_receipt = deploy_client.wait_for_transaction(call_txn_hash) assert client_contract.v_address() == deploy_coinbase
def test_abi_encode_single_int(): assert abi.encode_single(['int', '256', []], -2 ** 255) == (b'\x80' + b'\x00' * 31) assert abi.encode_single( ['int', '256', []], (b'\x80' + b'\x00' * 31)) == (b'\x80' + b'\x00' * 31) assert abi.encode_single(['int', '8', []], -128)[-1:] == b'\x80' with pytest.raises(abi.ValueOutOfBounds): assert abi.encode_single(['int', '8', []], -129) assert abi.encode_single(['int', '8', []], 127) == zpad(b'\x7f', 32) with pytest.raises(abi.ValueOutOfBounds): assert abi.encode_single(['int', '8', []], 128)
def test_execution_of_call_with_single_bytes32(deploy_client, deployed_contracts, deploy_coinbase, deploy_future_block_call): client_contract = deployed_contracts.TestCallExecution value = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' call = deploy_future_block_call( client_contract.setBytes32, call_data=abi.encode_single(abi.process_type('bytes32'), value), ) deploy_client.wait_for_block(call.targetBlock()) assert client_contract.v_bytes32() is None call_txn_hash = call.execute() call_txn_receipt = deploy_client.wait_for_transaction(call_txn_hash) assert client_contract.v_bytes32() == value
def test_encode_fixed(): fixed128x128 = ('fixed', '128x128', []) _2_125 = decode_hex(b'00000000000000000000000000000002' b'20000000000000000000000000000000') _8_5 = decode_hex(b'00000000000000000000000000000008' b'80000000000000000000000000000000') assert encode_single(fixed128x128, 2.125) == _2_125 assert encode_single(fixed128x128, 8.5) == _8_5 assert encode_single(fixed128x128, 1.125) == (b'\x00' * 15 + b'\x01\x20' + b'\x00' * 15) assert encode_single(fixed128x128, -1.125) == (b'\xff' * 15 + b'\xfe' + b'\xe0' + b'\x00' * 15) with pytest.raises(ValueOutOfBounds): encode_single(fixed128x128, 2**127) with pytest.raises(ValueOutOfBounds): encode_single(fixed128x128, -2**127 - 1)
def test_encode_dynamic_bytes(): dynamic_bytes = ('bytes', '', []) uint256 = ('uint', '256', []) # only the size of the bytes assert encode_single(dynamic_bytes, b'') == zpad(b'\x00', 32) a = encode_single(uint256, 1) + rzpad(b'\x61', 32) assert encode_single(dynamic_bytes, b'\x61') == a dave_bin = decode_hex( b'0000000000000000000000000000000000000000000000000000000000000004' b'6461766500000000000000000000000000000000000000000000000000000000') dave = encode_single(uint256, 4) + rzpad(b'\x64\x61\x76\x65', 32) assert encode_single(dynamic_bytes, b'\x64\x61\x76\x65') == dave_bin assert encode_single(dynamic_bytes, b'\x64\x61\x76\x65') == dave
def test_execution_of_call_with_single_uint(deploy_client, deployed_contracts, deploy_future_block_call): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call(client_contract.setUInt) signature = call.registerData.encoded_abi_signature data = abi.encode_single(abi.process_type('uint256'), 1234567890) txn_data = ''.join((utils.encode_hex(signature), utils.encode_hex(data))) data_txn_hash = deploy_client.send_transaction( to=call._meta.address, data=txn_data, ) data_txn_receipt = deploy_client.wait_for_transaction(data_txn_hash) assert client_contract.v_uint() == 0 call_txn_hash = call.execute() deploy_client.wait_for_transaction(call_txn_hash) assert client_contract.v_uint() == 1234567890
def test_execution_of_call_with_single_bytes(deploy_client, deployed_contracts, deploy_coinbase, deploy_future_block_call, CallLib): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call(client_contract.setBytes) value = 'abcd' signature = call.registerData.encoded_abi_signature data = abi.encode_single(abi.process_type('bytes'), value) txn_data = ''.join((utils.encode_hex(signature), utils.encode_hex(data))) data_txn_hash = deploy_client.send_transaction( to=call._meta.address, data=txn_data, ) data_txn_receipt = deploy_client.wait_for_transaction(data_txn_hash) assert client_contract.v_bytes() == '' assert call.callData() == data #call_txn_hash = call.execute() call_txn_hash = client_contract.setBytes(value) txn_r = deploy_client.wait_for_transaction(call_txn_hash) txn = deploy_client.get_transaction_by_hash(call_txn_hash) assert txn['input'] == txn_data call_logs = CallLib.CallExecuted.get_transaction_logs(call_txn_hash) call_data = [CallLib.CallExecuted.get_log_data(l) for l in call_logs] bytes_logs = client_contract.Bytes.get_transaction_logs(call_txn_hash) bytes_data = [client_contract.Bytes.get_log_data(l) for l in bytes_logs] assert client_contract.v_bytes() == value
def test_execution_of_call_with_single_address(deploy_client, deployed_contracts, deploy_coinbase, deploy_future_block_call): client_contract = deployed_contracts.TestCallExecution call = deploy_future_block_call(client_contract.setAddress) signature = call.registerData.encoded_abi_signature data = abi.encode_single(abi.process_type('address'), deploy_coinbase[2:]) txn_data = ''.join((utils.encode_hex(signature), utils.encode_hex(data))) data_txn_hash = deploy_client.send_transaction( to=call._meta.address, data=txn_data, ) data_txn_receipt = deploy_client.wait_for_transaction(data_txn_hash) assert client_contract.v_address() == '0x0000000000000000000000000000000000000000' call_txn_hash = call.execute() deploy_client.wait_for_transaction(call_txn_hash) assert client_contract.v_address() == deploy_coinbase
def test_abi_decode_single_bytes(): typ = ['bytes', '8', []] assert (b'\x01\x02' + b'\x00'*6) == abi.decode_single(typ, abi.encode_single(typ, b'\x01\x02')) typ = ['bytes', '', []] assert b'\x01\x02' == abi.decode_single(typ, abi.encode_single(typ, b'\x01\x02'))
def test_abi_encode_single_prefixed_address(): prefixed_address = '0x' + '0' * 40 assert abi.encode_single( ['address', '', []], prefixed_address) == b'\x00' * 32
def test_abi_decode_single_hash(): typ = ['hash', '8', []] assert b'\x01' * \ 8 == abi.decode_single(typ, abi.encode_single(typ, b'\x01' * 8))
def test_abi_encode_single_hash(): assert abi.encode_single(['hash', '8', []], b'\x00' * 8) == b'\x00' * 32 assert abi.encode_single(['hash', '8', []], '00' * 8) == b'\x00' * 32
def test_abi_encode_single_ureal(): assert abi.encode_single(['ureal', '128x128', []], 0) == (b'\x00'*32) assert abi.encode_single(['ureal', '128x128', []], 1.125) == (b'\x00'*15 + b'\x01\x20' + b'\x00'*15) assert abi.encode_single(['ureal', '128x128', []], 2**127-1) == (b'\x7f' + b'\xff'*15 + b'\x00'*16)
def test_encode_decode_hash(): hash8 = ('hash', '8', []) hash1 = b'\x01' * 8 assert hash1 == decode_single(hash8, encode_single(hash8, hash1))
def test_abi_encode_single_real(): assert abi.encode_single(['real', '128x128', []], 1.125) == (b'\x00'*15 + b'\x01\x20' + b'\x00'*15) assert abi.encode_single(['real', '128x128', []], -1.125) == (b'\xff'*15 + b'\xfe' + b'\xe0' + b'\x00'*15)
def test_abi_encode_single_hash(): assert abi.encode_single(['hash', '8', []], b'\x00'*8) == b'\x00'*32 assert abi.encode_single(['hash', '8', []], '00'*8) == b'\x00'*32
def test_abi_decode_single_hash(): typ = ['hash', '8', []] assert b'\x01'*8 == abi.decode_single(typ, abi.encode_single(typ, b'\x01'*8))
def test_encode_hash(): hash8 = ('hash', '8', []) assert encode_single(hash8, b'\x00' * 8) == b'\x00' * 32 assert encode_single(hash8, b'00' * 8) == b'\x00' * 32
def test_encode_int(): int8 = ('int', '8', []) int32 = ('int', '32', []) int256 = ('int', '256', []) int256_maximum = ( b'\x7f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') int256_minimum = ( b'\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') int256_128 = ( b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80') int256_2_to_31 = ( b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x00\x00') int256_negative_one = ( b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') assert encode_single(int256, int256_minimum) == int256_minimum assert encode_single(int8, 0) == zpad(b'\x00', 32) assert encode_single(int8, 2**7 - 1) == zpad(b'\x7f', 32) assert encode_single(int8, -1) == zpad(b'\xff', 32) assert encode_single(int8, -2**7) == zpad(b'\x80', 32) with pytest.raises(ValueOutOfBounds): encode_single(int8, 128) with pytest.raises(ValueOutOfBounds): encode_single(int8, -129) assert encode_single(int32, 0) == zpad(b'\x00', 32) assert encode_single(int32, 2**7 - 1) == zpad(b'\x7f', 32) assert encode_single(int32, 2**31 - 1) == zpad(b'\x7f\xff\xff\xff', 32) assert encode_single(int32, -1) == zpad(b'\xff\xff\xff\xff', 32) assert encode_single(int32, -2**7) == zpad(b'\xff\xff\xff\x80', 32) assert encode_single(int32, -2**31) == zpad(b'\x80\x00\x00\x00', 32) with pytest.raises(ValueOutOfBounds): encode_single(int32, 2**32) with pytest.raises(ValueOutOfBounds): encode_single(int32, -(2**32)) assert encode_single(int256, 0) == zpad(b'\x00', 32) assert encode_single(int256, 2**7 - 1) == zpad(b'\x7f', 32) assert encode_single(int256, 2**31 - 1) == zpad(b'\x7f\xff\xff\xff', 32) assert encode_single(int256, 2**255 - 1) == int256_maximum assert encode_single(int256, -1) == int256_negative_one assert encode_single(int256, -2**7) == int256_128 assert encode_single(int256, -2**31) == int256_2_to_31 assert encode_single(int256, -2**255) == int256_minimum with pytest.raises(ValueOutOfBounds): encode_single(int256, 2**256) with pytest.raises(ValueOutOfBounds): encode_single(int256, -(2**256))
def test_encode_uint(): uint8 = ('uint', '8', []) uint32 = ('uint', '32', []) uint256 = ('uint', '256', []) with pytest.raises(ValueOutOfBounds): encode_single(uint8, -1) with pytest.raises(ValueOutOfBounds): encode_single(uint32, -1) with pytest.raises(ValueOutOfBounds): encode_single(uint256, -1) assert encode_single(uint8, 0) == zpad(b'\x00', 32) assert encode_single(uint32, 0) == zpad(b'\x00', 32) assert encode_single(uint256, 0) == zpad(b'\x00', 32) assert encode_single(uint8, 1) == zpad(b'\x01', 32) assert encode_single(uint32, 1) == zpad(b'\x01', 32) assert encode_single(uint256, 1) == zpad(b'\x01', 32) assert encode_single(uint8, 2**8 - 1) == zpad(b'\xff', 32) assert encode_single(uint32, 2**8 - 1) == zpad(b'\xff', 32) assert encode_single(uint256, 2**8 - 1) == zpad(b'\xff', 32) assert encode_single(uint32, 2**32 - 1) == zpad(b'\xff\xff\xff\xff', 32) assert encode_single(uint256, 2**32 - 1) == zpad(b'\xff\xff\xff\xff', 32) uint256_maximum = ( b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') assert encode_single(uint256, 2**256 - 1) == uint256_maximum
def test_abi_encode_single_prefixed_address(): prefixed_address = '0x' + '0'*40 assert abi.encode_single(['address', '', []], prefixed_address) == b'\x00' * 32