|
|
|
@@ -178,7 +178,11 @@ impl Test {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn confirm_next_serai_key_tx(&self) -> TxLegacy {
|
|
|
|
fn confirm_next_serai_key_tx(&self) -> TxLegacy {
|
|
|
|
let msg = Router::confirm_next_serai_key_message(self.chain_id, self.state.next_nonce);
|
|
|
|
let msg = Router::confirm_next_serai_key_message(
|
|
|
|
|
|
|
|
self.chain_id,
|
|
|
|
|
|
|
|
self.router.address(),
|
|
|
|
|
|
|
|
self.state.next_nonce,
|
|
|
|
|
|
|
|
);
|
|
|
|
let sig = sign(self.state.next_key.unwrap(), &msg);
|
|
|
|
let sig = sign(self.state.next_key.unwrap(), &msg);
|
|
|
|
|
|
|
|
|
|
|
|
self.router.confirm_next_serai_key(&sig)
|
|
|
|
self.router.confirm_next_serai_key(&sig)
|
|
|
|
@@ -227,7 +231,12 @@ impl Test {
|
|
|
|
fn update_serai_key_tx(&self) -> ((Scalar, PublicKey), TxLegacy) {
|
|
|
|
fn update_serai_key_tx(&self) -> ((Scalar, PublicKey), TxLegacy) {
|
|
|
|
let next_key = test_key();
|
|
|
|
let next_key = test_key();
|
|
|
|
|
|
|
|
|
|
|
|
let msg = Router::update_serai_key_message(self.chain_id, self.state.next_nonce, &next_key.1);
|
|
|
|
let msg = Router::update_serai_key_message(
|
|
|
|
|
|
|
|
self.chain_id,
|
|
|
|
|
|
|
|
self.router.address(),
|
|
|
|
|
|
|
|
self.state.next_nonce,
|
|
|
|
|
|
|
|
&next_key.1,
|
|
|
|
|
|
|
|
);
|
|
|
|
let sig = sign(self.state.key.unwrap(), &msg);
|
|
|
|
let sig = sign(self.state.key.unwrap(), &msg);
|
|
|
|
|
|
|
|
|
|
|
|
(next_key, self.router.update_serai_key(&next_key.1, &sig))
|
|
|
|
(next_key, self.router.update_serai_key(&next_key.1, &sig))
|
|
|
|
@@ -275,6 +284,7 @@ impl Test {
|
|
|
|
) -> ([u8; 32], TxLegacy) {
|
|
|
|
) -> ([u8; 32], TxLegacy) {
|
|
|
|
let msg = Router::execute_message(
|
|
|
|
let msg = Router::execute_message(
|
|
|
|
self.chain_id,
|
|
|
|
self.chain_id,
|
|
|
|
|
|
|
|
self.router.address(),
|
|
|
|
self.state.next_nonce,
|
|
|
|
self.state.next_nonce,
|
|
|
|
coin,
|
|
|
|
coin,
|
|
|
|
fee,
|
|
|
|
fee,
|
|
|
|
@@ -468,11 +478,10 @@ async fn test_update_serai_key() {
|
|
|
|
|
|
|
|
|
|
|
|
// But we shouldn't be able to update the key to None
|
|
|
|
// But we shouldn't be able to update the key to None
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
let router_address_u256: U256 = test.router.address().into_word().into();
|
|
|
|
|
|
|
|
let s: U256 = (router_address_u256 << 96) | U256::from(test.state.next_nonce);
|
|
|
|
let msg = crate::abi::updateSeraiKeyCall::new((
|
|
|
|
let msg = crate::abi::updateSeraiKeyCall::new((
|
|
|
|
crate::abi::Signature {
|
|
|
|
crate::abi::Signature { c: test.chain_id.into(), s: s.into() },
|
|
|
|
c: test.chain_id.into(),
|
|
|
|
|
|
|
|
s: U256::try_from(test.state.next_nonce).unwrap().into(),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
[0; 32].into(),
|
|
|
|
[0; 32].into(),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.abi_encode();
|
|
|
|
.abi_encode();
|
|
|
|
@@ -822,7 +831,7 @@ async fn test_reentrancy() {
|
|
|
|
|
|
|
|
|
|
|
|
#[tokio::test]
|
|
|
|
#[tokio::test]
|
|
|
|
async fn fuzz_test_out_instructions_gas() {
|
|
|
|
async fn fuzz_test_out_instructions_gas() {
|
|
|
|
for _ in 0 .. 10 {
|
|
|
|
for _ in 0 .. 100 {
|
|
|
|
let mut test = Test::new().await;
|
|
|
|
let mut test = Test::new().await;
|
|
|
|
test.confirm_next_serai_key().await;
|
|
|
|
test.confirm_next_serai_key().await;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -840,7 +849,7 @@ async fn fuzz_test_out_instructions_gas() {
|
|
|
|
code.extend(&ext);
|
|
|
|
code.extend(&ext);
|
|
|
|
|
|
|
|
|
|
|
|
out_instructions.push((
|
|
|
|
out_instructions.push((
|
|
|
|
SeraiEthereumAddress::Contract(ContractDeployment::new(100_000, ext).unwrap()),
|
|
|
|
SeraiEthereumAddress::Contract(ContractDeployment::new(100_000, code).unwrap()),
|
|
|
|
amount_out,
|
|
|
|
amount_out,
|
|
|
|
));
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@@ -906,33 +915,10 @@ async fn test_gas_increases_then_decreases() {
|
|
|
|
expected *and the fee for it*. This fee is guaranteed to cost the reported amount of gas,
|
|
|
|
expected *and the fee for it*. This fee is guaranteed to cost the reported amount of gas,
|
|
|
|
resolving this issue.
|
|
|
|
resolving this issue.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#[rustfmt::skip]
|
|
|
|
let out_instructions = vec![(
|
|
|
|
let out_instructions = vec![
|
|
|
|
SeraiEthereumAddress::Contract(ContractDeployment::new(100240, vec![]).unwrap()),
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([73, 151, 53, 42, 64, 102, 196, 80, 244, 167, 149, 81, 236, 231, 65, 18, 68, 196, 173, 20])), U256::from(1u8)),
|
|
|
|
U256::from(1u8),
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([7, 232, 97, 33, 54, 141, 246, 45, 29, 138, 221, 30, 2, 179, 142, 165, 169, 45, 143, 126])), U256::from(1u8)),
|
|
|
|
)];
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([73, 151, 53, 42, 64, 102, 196, 80, 244, 167, 149, 81, 236, 231, 65, 18, 68, 196, 173, 20])), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([34, 132, 167, 44, 12, 171, 57, 177, 197, 88, 60, 255, 68, 75, 2, 139, 76, 138, 78, 222])), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([221, 218, 210, 119, 213, 189, 65, 118, 205, 113, 19, 11, 83, 58, 129, 203, 123, 76, 202, 99])), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([34, 132, 167, 44, 12, 171, 57, 177, 197, 88, 60, 255, 68, 75, 2, 139, 76, 138, 78, 222])), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([82, 31, 116, 111, 9, 110, 56, 51, 122, 38, 10, 227, 36, 134, 181, 185, 255, 149, 195, 254])), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([36, 68, 76, 140, 254, 107, 233, 107, 186, 85, 5, 37, 65, 201, 63, 17, 135, 244, 148, 1])), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([34, 132, 167, 44, 12, 171, 57, 177, 197, 88, 60, 255, 68, 75, 2, 139, 76, 138, 78, 222])), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([26, 54, 156, 184, 48, 50, 23, 219, 43, 54, 56, 131, 245, 126, 70, 17, 235, 56, 130, 124])), U256::from(1u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([152, 27, 239, 11, 196, 99, 61, 136, 23, 8, 58, 242, 166, 235, 106, 167, 45, 175, 69, 247])), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([152, 27, 239, 11, 196, 99, 61, 136, 23, 8, 58, 242, 166, 235, 106, 167, 45, 175, 69, 247])), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Address(**Address::from([7, 232, 97, 33, 54, 141, 246, 45, 29, 138, 221, 30, 2, 179, 142, 165, 169, 45, 143, 126])), U256::from(0u8)),
|
|
|
|
|
|
|
|
(SeraiEthereumAddress::Contract(ContractDeployment::new(100000, vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()), U256::from(1u8))
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut test = Test::new().await;
|
|
|
|
let mut test = Test::new().await;
|
|
|
|
test.confirm_next_serai_key().await;
|
|
|
|
test.confirm_next_serai_key().await;
|
|
|
|
@@ -940,12 +926,15 @@ async fn test_gas_increases_then_decreases() {
|
|
|
|
let out_instructions = OutInstructions::from(out_instructions.as_slice());
|
|
|
|
let out_instructions = OutInstructions::from(out_instructions.as_slice());
|
|
|
|
|
|
|
|
|
|
|
|
let coin = {
|
|
|
|
let coin = {
|
|
|
|
let erc20 = Erc20::deploy(&test).await;
|
|
|
|
let () = test
|
|
|
|
erc20.mint(&test, test.router.address(), U256::from(1_000_000_000)).await;
|
|
|
|
.provider
|
|
|
|
Coin::Erc20(erc20.address())
|
|
|
|
.raw_request("anvil_setBalance".into(), (test.router.address(), 1_000_000_000))
|
|
|
|
|
|
|
|
.await
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
Coin::Ether
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let fee_per_gas = U256::from(4);
|
|
|
|
let fee_per_gas = U256::from(1);
|
|
|
|
let (gas, fee) = test.router.execute_gas_and_fee(coin, fee_per_gas, &out_instructions);
|
|
|
|
let (gas, fee) = test.router.execute_gas_and_fee(coin, fee_per_gas, &out_instructions);
|
|
|
|
assert!((U256::from(gas) * fee_per_gas) != fee);
|
|
|
|
assert!((U256::from(gas) * fee_per_gas) != fee);
|
|
|
|
let (tx, gas_used) =
|
|
|
|
let (tx, gas_used) =
|
|
|
|
|