Skip to content
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

fix(rpc): v7 and v6 shouldn't loop over all 3 core Resources #2576

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"l2_to_l1_messages": [],
"events": [],
"actual_fee": "0x247aff6e224"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
"max_amount": "0x186a0",
"max_price_per_unit": "0x5af3107a4000"
},
"L2_GAS": { "max_amount": "0x0", "max_price_per_unit": "0x0" }
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
},
"L1_DATA_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"tip": "0x0",
"paymaster_data": [],
Expand All @@ -32,4 +39,4 @@
],
"type": "DEPLOY_ACCOUNT"
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
{"execution_status": "SUCCEEDED","finality_status": "ACCEPTED_ON_L1","status": "ACCEPTED_ON_L1","block_hash": "0x1fc2d8ff40c81138119a6283ba51610a7d120494c4f0d5fef40443a7e990aa2","block_number": 319684,"transaction_index": 0,"transaction": {"transaction_hash": "0x2d667ed0aa3a8faef96b466972079826e592ec0aebefafd77a39f2ed06486b4","version": "0x1","max_fee": "0x2386f26fc10000","signature": ["0x17872d12092aa60331394f514de908309fdba185997fd3d0be1e2896cd1e053","0x66124ebfe1a34809b2223a9707ac796dc6f4b6310cb002bda1e4c062a4b2867"],"nonce": "0x1078","class_hash": "0x772164c9d6179a89e7f1167f099219f47d752304b16ed01f081b6e0b45c93c3","sender_address": "0x52125c1e043126c637d1436d9551ef6c4f6e3e36945676bbd716a56e3a41b7a","type": "DECLARE"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L1",
"status": "ACCEPTED_ON_L1",
"block_hash": "0x1fc2d8ff40c81138119a6283ba51610a7d120494c4f0d5fef40443a7e990aa2",
"block_number": 319684,
"transaction_index": 0,
"transaction": {
"transaction_hash": "0x2d667ed0aa3a8faef96b466972079826e592ec0aebefafd77a39f2ed06486b4",
"version": "0x1",
"max_fee": "0x2386f26fc10000",
"signature": [
"0x17872d12092aa60331394f514de908309fdba185997fd3d0be1e2896cd1e053",
"0x66124ebfe1a34809b2223a9707ac796dc6f4b6310cb002bda1e4c062a4b2867"
],
"nonce": "0x1078",
"class_hash": "0x772164c9d6179a89e7f1167f099219f47d752304b16ed01f081b6e0b45c93c3",
"sender_address": "0x52125c1e043126c637d1436d9551ef6c4f6e3e36945676bbd716a56e3a41b7a",
"type": "DECLARE"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
{"execution_status": "SUCCEEDED", "finality_status": "ACCEPTED_ON_L1", "status": "ACCEPTED_ON_L1", "block_hash": "0x53ce679e80fdcb9773de0e45871524f2e5dad2010366a1a06f47d8744fccad4", "block_number": 219581, "transaction_index": 0, "transaction": {"transaction_hash": "0x2e3106421d38175020cd23a6f1bff87989a64cae6a679c54c7710a033d88faa", "version": "0x0", "contract_address": "0x18c17afbe50afac8aa6e25bb95a6d7983f0d8a7557fbf98bdad3ccf531a9b60", "contract_address_salt": "0x5de1c0a37865820ce4896872e78da6877b0a8eede3d363131734556a8815d52", "class_hash": "0x71468bd837666b3a05cca1a5363b0d9e15cacafd6eeaddfbc4f00d5c7b9a51d", "constructor_calldata": [], "type": "DEPLOY"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L1",
"status": "ACCEPTED_ON_L1",
"block_hash": "0x53ce679e80fdcb9773de0e45871524f2e5dad2010366a1a06f47d8744fccad4",
"block_number": 219581,
"transaction_index": 0,
"transaction": {
"transaction_hash": "0x2e3106421d38175020cd23a6f1bff87989a64cae6a679c54c7710a033d88faa",
"version": "0x0",
"contract_address": "0x18c17afbe50afac8aa6e25bb95a6d7983f0d8a7557fbf98bdad3ccf531a9b60",
"contract_address_salt": "0x5de1c0a37865820ce4896872e78da6877b0a8eede3d363131734556a8815d52",
"class_hash": "0x71468bd837666b3a05cca1a5363b0d9e15cacafd6eeaddfbc4f00d5c7b9a51d",
"constructor_calldata": [],
"type": "DEPLOY"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
{"execution_status": "SUCCEEDED", "finality_status": "ACCEPTED_ON_L2", "status": "ACCEPTED_ON_L2", "block_hash": "0x3372a677fc331bfdc6c4ee5430b4b934b486668dedbfeadae5e50b9af37a27e", "block_number": 319709, "transaction_index": 1, "transaction": {"transaction_hash": "0x41d1f5206ef58a443e7d3d1ca073171ec25fa75313394318fc83a074a6631c3", "version": "0x3", "signature": ["0x29a49dff154fede73dd7b5ca5a0beadf40b4b069f3a850cd8428e54dc809ccc", "0x429d142a17223b4f2acde0f5ecb9ad453e188b245003c86fab5c109bad58fc3"], "nonce": "0x1", "nonce_data_availability_mode": 0, "fee_data_availability_mode": 0, "resource_bounds": {"L1_GAS": {"max_amount": "0x186a0", "max_price_per_unit": "0x2540be400"}, "L2_GAS": {"max_amount": "0x0", "max_price_per_unit": "0x0"}}, "tip": "0x0", "paymaster_data": [], "sender_address": "0x2fab82e4aef1d8664874e1f194951856d48463c3e6bf9a8c68e234a629a6f50", "class_hash": "0x5ae9d09292a50ed48c5930904c880dab56e85b825022a7d689cfc9e65e01ee7", "compiled_class_hash": "0x1add56d64bebf8140f3b8a38bdf102b7874437f0c861ab4ca7526ec33b4d0f8", "account_deployment_data": [], "type": "DECLARE"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L2",
"status": "ACCEPTED_ON_L2",
"block_hash": "0x3372a677fc331bfdc6c4ee5430b4b934b486668dedbfeadae5e50b9af37a27e",
"block_number": 319709,
"transaction_index": 1,
"transaction": {
"transaction_hash": "0x41d1f5206ef58a443e7d3d1ca073171ec25fa75313394318fc83a074a6631c3",
"version": "0x3",
"signature": [
"0x29a49dff154fede73dd7b5ca5a0beadf40b4b069f3a850cd8428e54dc809ccc",
"0x429d142a17223b4f2acde0f5ecb9ad453e188b245003c86fab5c109bad58fc3"
],
"nonce": "0x1",
"nonce_data_availability_mode": 0,
"fee_data_availability_mode": 0,
"resource_bounds": {
"L1_GAS": {
"max_amount": "0x186a0",
"max_price_per_unit": "0x2540be400"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
},
"L1_DATA_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"tip": "0x0",
"paymaster_data": [],
"sender_address": "0x2fab82e4aef1d8664874e1f194951856d48463c3e6bf9a8c68e234a629a6f50",
"class_hash": "0x5ae9d09292a50ed48c5930904c880dab56e85b825022a7d689cfc9e65e01ee7",
"compiled_class_hash": "0x1add56d64bebf8140f3b8a38bdf102b7874437f0c861ab4ca7526ec33b4d0f8",
"account_deployment_data": [],
"type": "DECLARE"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
{"execution_status": "SUCCEEDED","finality_status": "ACCEPTED_ON_L1","status": "ACCEPTED_ON_L1","block_hash": "0x75ab4efa3e2d8942defff7dedf2660432a9cb50f28834cf948c20490a9df94d","block_number": 320525,"transaction_index": 4,"transaction": {"transaction_hash": "0x44b971f7eface29b185f86dd7b3b70acb1e48e0ad459e3a41e06fc42937aaa4","version": "0x2","max_fee": "0x50c8f30c048","signature": ["0x42a40a113a4381e5f304fd28a707ba4182609db42062a7f36b9291bf8ae8ae7","0x6035bcf022f887c80dbc2b615e927d662637d2213335ee657893dce8ddabe5b"],"nonce": "0x11","class_hash": "0x7cb013a4139335cefce52adc2ac342c0110811353e7992baefbe547200223c7","compiled_class_hash": "0x67f7deab53a3ba70500bdafe66fb3038bbbaadb36a6dd1a7a5fc5b094e9d724","sender_address": "0x3bb81d22ecd0e0a6f3138bdc5c072ff5726c5add02bcfd5b81cd657a6ae10a8","type": "DECLARE"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L1",
"status": "ACCEPTED_ON_L1",
"block_hash": "0x75ab4efa3e2d8942defff7dedf2660432a9cb50f28834cf948c20490a9df94d",
"block_number": 320525,
"transaction_index": 4,
"transaction": {
"transaction_hash": "0x44b971f7eface29b185f86dd7b3b70acb1e48e0ad459e3a41e06fc42937aaa4",
"version": "0x2",
"max_fee": "0x50c8f30c048",
"signature": [
"0x42a40a113a4381e5f304fd28a707ba4182609db42062a7f36b9291bf8ae8ae7",
"0x6035bcf022f887c80dbc2b615e927d662637d2213335ee657893dce8ddabe5b"
],
"nonce": "0x11",
"class_hash": "0x7cb013a4139335cefce52adc2ac342c0110811353e7992baefbe547200223c7",
"compiled_class_hash": "0x67f7deab53a3ba70500bdafe66fb3038bbbaadb36a6dd1a7a5fc5b094e9d724",
"sender_address": "0x3bb81d22ecd0e0a6f3138bdc5c072ff5726c5add02bcfd5b81cd657a6ae10a8",
"type": "DECLARE"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
{"execution_status": "SUCCEEDED", "finality_status": "ACCEPTED_ON_L1", "status": "ACCEPTED_ON_L1", "block_hash": "0x50e864db6b81ce69fbeb70e6a7284ee2febbb9a2e707415de7adab83525e9cd", "block_number": 319132, "transaction_index": 0, "transaction": {"transaction_hash": "0x49728601e0bb2f48ce506b0cbd9c0e2a9e50d95858aa41463f46386dca489fd", "version": "0x3", "signature": ["0x71a9b2cd8a8a6a4ca284dcddcdefc6c4fd20b92c1b201bd9836e4ce376fad16", "0x6bef4745194c9447fdc8dd3aec4fc738ab0a560b0d2c7bf62fbf58aef3abfc5"], "nonce": "0xe97", "nonce_data_availability_mode": 0, "fee_data_availability_mode": 0, "resource_bounds": {"L1_GAS": {"max_amount": "0x186a0", "max_price_per_unit": "0x5af3107a4000"}, "L2_GAS": {"max_amount": "0x0", "max_price_per_unit": "0x0"}}, "tip": "0x0", "paymaster_data": [], "sender_address": "0x3f6f3bc663aedc5285d6013cc3ffcbc4341d86ab488b8b68d297f8258793c41", "calldata": ["0x2", "0x450703c32370cf7ffff540b9352e7ee4ad583af143a361155f2b485c0c39684", "0x27c3334165536f239cfd400ed956eabff55fc60de4fb56728b6a4f6b87db01c", "0x0", "0x4", "0x4c312760dfd17a954cdd09e76aa9f149f806d88ec3e402ffaf5c4926f568a42", "0x5df99ae77df976b4f0e5cf28c7dcfe09bd6e81aab787b19ac0c08e03d928cf", "0x4", "0x1", "0x5", "0x450703c32370cf7ffff540b9352e7ee4ad583af143a361155f2b485c0c39684", "0x5df99ae77df976b4f0e5cf28c7dcfe09bd6e81aab787b19ac0c08e03d928cf", "0x1", "0x7fe4fd616c7fece1244b3616bb516562e230be8c9f29668b46ce0369d5ca829", "0x287acddb27a2f9ba7f2612d72788dc96a5b30e401fc1e8072250940e024a587"], "account_deployment_data": [], "type": "INVOKE_FUNCTION"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L1",
"status": "ACCEPTED_ON_L1",
"block_hash": "0x50e864db6b81ce69fbeb70e6a7284ee2febbb9a2e707415de7adab83525e9cd",
"block_number": 319132,
"transaction_index": 0,
"transaction": {
"transaction_hash": "0x49728601e0bb2f48ce506b0cbd9c0e2a9e50d95858aa41463f46386dca489fd",
"version": "0x3",
"signature": [
"0x71a9b2cd8a8a6a4ca284dcddcdefc6c4fd20b92c1b201bd9836e4ce376fad16",
"0x6bef4745194c9447fdc8dd3aec4fc738ab0a560b0d2c7bf62fbf58aef3abfc5"
],
"nonce": "0xe97",
"nonce_data_availability_mode": 0,
"fee_data_availability_mode": 0,
"resource_bounds": {
"L1_GAS": {
"max_amount": "0x186a0",
"max_price_per_unit": "0x5af3107a4000"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
},
"L1_DATA_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"tip": "0x0",
"paymaster_data": [],
"sender_address": "0x3f6f3bc663aedc5285d6013cc3ffcbc4341d86ab488b8b68d297f8258793c41",
"calldata": [
"0x2",
"0x450703c32370cf7ffff540b9352e7ee4ad583af143a361155f2b485c0c39684",
"0x27c3334165536f239cfd400ed956eabff55fc60de4fb56728b6a4f6b87db01c",
"0x0",
"0x4",
"0x4c312760dfd17a954cdd09e76aa9f149f806d88ec3e402ffaf5c4926f568a42",
"0x5df99ae77df976b4f0e5cf28c7dcfe09bd6e81aab787b19ac0c08e03d928cf",
"0x4",
"0x1",
"0x5",
"0x450703c32370cf7ffff540b9352e7ee4ad583af143a361155f2b485c0c39684",
"0x5df99ae77df976b4f0e5cf28c7dcfe09bd6e81aab787b19ac0c08e03d928cf",
"0x1",
"0x7fe4fd616c7fece1244b3616bb516562e230be8c9f29668b46ce0369d5ca829",
"0x287acddb27a2f9ba7f2612d72788dc96a5b30e401fc1e8072250940e024a587"
],
"account_deployment_data": [],
"type": "INVOKE_FUNCTION"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"contract_address": "0x2cbc1f6e80a024900dc949914c7692f802ba90012cda39115db5640f5eca847",
"type": "INVOKE_FUNCTION"
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
{"execution_status": "SUCCEEDED", "finality_status": "ACCEPTED_ON_L1", "status": "ACCEPTED_ON_L1", "block_hash": "0x5e1de2b8fdaa00f1200d9eb23c04009a316a80ab046c4f8ffbcc6bc1c2775f4", "block_number": 308943, "transaction_index": 104, "transaction": {"transaction_hash": "0x658f1c44ebf6a1540eac0680956c3a9d315f65d2cb3b53593345905fed3982a", "version": "0x1", "max_fee": "0x2386f273b213da", "signature": ["0x7d31509f555031323050ed226012f0c6361b3dc34f0f5d2c65a76870fd8908b", "0x58d64f6d39dfb20586da0c40e3d575cab940009cdee6423b03268fd893bd27a"], "nonce": "0x0", "contract_address": "0x7cca85f128a38b326ed94107c6261a33109086398859c9d8717b71ce1d36890", "contract_address_salt": "0x7b9f4b7d6d49b60686004dd850a4b41c818d6eb69e226b8ea37ea025e6830f5", "class_hash": "0x5a9941d0cc16b8619a3325055472da709a66113afcc6a8ab86055da7d29c5f8", "constructor_calldata": ["0x7b16a9b7bb08d36950aa5d27d4d2c64bfd54f3ae16a0e01f21a6d410cb5179c"], "type": "DEPLOY_ACCOUNT"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L1",
"status": "ACCEPTED_ON_L1",
"block_hash": "0x5e1de2b8fdaa00f1200d9eb23c04009a316a80ab046c4f8ffbcc6bc1c2775f4",
"block_number": 308943,
"transaction_index": 104,
"transaction": {
"transaction_hash": "0x658f1c44ebf6a1540eac0680956c3a9d315f65d2cb3b53593345905fed3982a",
"version": "0x1",
"max_fee": "0x2386f273b213da",
"signature": [
"0x7d31509f555031323050ed226012f0c6361b3dc34f0f5d2c65a76870fd8908b",
"0x58d64f6d39dfb20586da0c40e3d575cab940009cdee6423b03268fd893bd27a"
],
"nonce": "0x0",
"contract_address": "0x7cca85f128a38b326ed94107c6261a33109086398859c9d8717b71ce1d36890",
"contract_address_salt": "0x7b9f4b7d6d49b60686004dd850a4b41c818d6eb69e226b8ea37ea025e6830f5",
"class_hash": "0x5a9941d0cc16b8619a3325055472da709a66113afcc6a8ab86055da7d29c5f8",
"constructor_calldata": [
"0x7b16a9b7bb08d36950aa5d27d4d2c64bfd54f3ae16a0e01f21a6d410cb5179c"
],
"type": "DEPLOY_ACCOUNT"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
{"execution_status": "SUCCEEDED", "finality_status": "ACCEPTED_ON_L1", "status": "ACCEPTED_ON_L1", "block_hash": "0x7b3788dbb11f103e5b3c4cf577c117ac21eff565dbbd3341d598b4d85784d", "block_number": 165336, "transaction_index": 4, "transaction": {"transaction_hash": "0x6d346ba207eb124355960c19c737698ad37a3c920a588b741e0130ff5bd4d6d", "version": "0x0", "max_fee": "0x0", "signature": [], "nonce": "0x0", "class_hash": "0x71e6ef53e53e6f5ca792fc4a5799a33e6f4118e4fd1d948dca3a371506f0cc7", "sender_address": "0x1", "type": "DECLARE"}}
{
"execution_status": "SUCCEEDED",
"finality_status": "ACCEPTED_ON_L1",
"status": "ACCEPTED_ON_L1",
"block_hash": "0x7b3788dbb11f103e5b3c4cf577c117ac21eff565dbbd3341d598b4d85784d",
"block_number": 165336,
"transaction_index": 4,
"transaction": {
"transaction_hash": "0x6d346ba207eb124355960c19c737698ad37a3c920a588b741e0130ff5bd4d6d",
"version": "0x0",
"max_fee": "0x0",
"signature": [],
"nonce": "0x0",
"class_hash": "0x71e6ef53e53e6f5ca792fc4a5799a33e6f4118e4fd1d948dca3a371506f0cc7",
"sender_address": "0x1",
"type": "DECLARE"
}
}
10 changes: 5 additions & 5 deletions rpc/v6/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ func adaptBroadcastedTransaction(broadcastedTxn *BroadcastedTransaction,
return txn, declaredClass, paidFeeOnL1, nil
}

func adaptResourceBounds(rb map[core.Resource]core.ResourceBounds) map[Resource]ResourceBounds {
func adaptResourceBounds(coreResourceBounds map[core.Resource]core.ResourceBounds) map[Resource]ResourceBounds {
rpcResourceBounds := make(map[Resource]ResourceBounds)
for resource, bounds := range rb {
rpcResourceBounds[Resource(resource)] = ResourceBounds{
MaxAmount: new(felt.Felt).SetUint64(bounds.MaxAmount),
MaxPricePerUnit: bounds.MaxPricePerUnit,
for _, resourceEnum := range []int{int(ResourceL1Gas), int(ResourceL2Gas)} {
rpcResourceBounds[Resource(resourceEnum)] = ResourceBounds{
MaxAmount: new(felt.Felt).SetUint64(coreResourceBounds[core.Resource(resourceEnum)].MaxAmount),
MaxPricePerUnit: coreResourceBounds[core.Resource(resourceEnum)].MaxPricePerUnit,
}
}
return rpcResourceBounds
Expand Down
20 changes: 11 additions & 9 deletions rpc/v7/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"

"github.com/NethermindEth/juno/adapters/sn2core"
"github.com/NethermindEth/juno/clients/gateway"
Expand Down Expand Up @@ -179,13 +180,14 @@ func (r Resource) MarshalText() ([]byte, error) {
}

func (r *Resource) UnmarshalJSON(data []byte) error {
switch string(data) {
case `"l1_gas"`:
str := string(data)
switch strings.ToLower(strings.Trim(str, `"`)) {
case "l1_gas":
*r = ResourceL1Gas
case `"l2_gas"`:
case "l2_gas":
*r = ResourceL2Gas
default:
return fmt.Errorf("unknown Resource: %q", string(data))
return fmt.Errorf("unknown Resource: %q", str)
}
return nil
}
Expand Down Expand Up @@ -361,12 +363,12 @@ func adaptBroadcastedTransaction(broadcastedTxn *BroadcastedTransaction,
return txn, declaredClass, paidFeeOnL1, nil
}

func adaptResourceBounds(rb map[core.Resource]core.ResourceBounds) map[Resource]ResourceBounds {
func adaptResourceBounds(coreResourceBounds map[core.Resource]core.ResourceBounds) map[Resource]ResourceBounds {
rpcResourceBounds := make(map[Resource]ResourceBounds)
for resource, bounds := range rb {
rpcResourceBounds[Resource(resource)] = ResourceBounds{
MaxAmount: new(felt.Felt).SetUint64(bounds.MaxAmount),
MaxPricePerUnit: bounds.MaxPricePerUnit,
for _, resourceEnum := range []int{int(ResourceL1Gas), int(ResourceL2Gas)} {
rpcResourceBounds[Resource(resourceEnum)] = ResourceBounds{
MaxAmount: new(felt.Felt).SetUint64(coreResourceBounds[core.Resource(resourceEnum)].MaxAmount),
MaxPricePerUnit: coreResourceBounds[core.Resource(resourceEnum)].MaxPricePerUnit,
}
}
return rpcResourceBounds
Expand Down
10 changes: 5 additions & 5 deletions rpc/v8/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ func adaptBroadcastedTransaction(broadcastedTxn *BroadcastedTransaction,
return txn, declaredClass, paidFeeOnL1, nil
}

func adaptResourceBounds(rb map[core.Resource]core.ResourceBounds) map[Resource]ResourceBounds {
func adaptResourceBounds(coreResourceBounds map[core.Resource]core.ResourceBounds) map[Resource]ResourceBounds {
rpcResourceBounds := make(map[Resource]ResourceBounds)
for resource, bounds := range rb {
rpcResourceBounds[Resource(resource)] = ResourceBounds{
MaxAmount: new(felt.Felt).SetUint64(bounds.MaxAmount),
MaxPricePerUnit: bounds.MaxPricePerUnit,
for _, resourceEnum := range []int{int(ResourceL1Gas), int(ResourceL2Gas), int(ResourceL1DataGas)} {
rpcResourceBounds[Resource(resourceEnum)] = ResourceBounds{
MaxAmount: new(felt.Felt).SetUint64(coreResourceBounds[core.Resource(resourceEnum)].MaxAmount),
MaxPricePerUnit: coreResourceBounds[core.Resource(resourceEnum)].MaxPricePerUnit,
}
}
return rpcResourceBounds
Expand Down
12 changes: 12 additions & 0 deletions rpc/v8/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,10 @@ func TestAddTransaction(t *testing.T) {
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
},
"L1_DATA": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"tip": "0x0",
Expand Down Expand Up @@ -1070,6 +1074,10 @@ func TestAddTransaction(t *testing.T) {
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
},
"L1_DATA": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"tip": "0x0",
Expand Down Expand Up @@ -1123,6 +1131,10 @@ func TestAddTransaction(t *testing.T) {
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
},
"L1_DATA": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"tip": "0x0",
Expand Down
Loading
Loading