Skip to content

Commit c016a19

Browse files
committed
[TxFeePayment] modify transaction fee payer transaction extension id to match transaction_extension_types variant object index
1 parent 561e224 commit c016a19

File tree

3 files changed

+64
-14
lines changed

3 files changed

+64
-14
lines changed

libraries/chain/include/eosio/chain/transaction.hpp

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ namespace eosio { namespace chain {
99

1010
enum transaction_extension_id {
1111
deferred_transaction_generation_context_id = 0,
12-
resource_payer_id,
12+
reserved_tx_ext_id_1 = 1,
13+
reserved_tx_ext_id_2 = 2,
14+
reserved_tx_ext_id_3 = 3,
15+
reserved_tx_ext_id_4 = 4,
16+
reserved_tx_ext_id_5 = 5,
17+
reserved_tx_ext_id_6 = 6,
18+
reserved_tx_ext_id_7 = 7,
19+
reserved_tx_ext_id_8 = 8,
20+
reserved_tx_ext_id_9 = 9,
21+
infrablockchain_transaction_fee_payer_tx_ext_id = 10,
22+
infrablockchain_transaction_vote_tx_ext_id = 11,
1323
TRANSACTION_EXTENSION_ID_COUNT,
1424

15-
// @see infrablockchain::chain::transaction_extension_id for additional tx exts for InfraBlockchain
25+
// @see infrablockchain/chain/transaction_extensions.hpp for additional tx exts for InfraBlockchain
1626
};
1727

1828
struct deferred_transaction_generation_context : fc::reflect_init {
@@ -34,6 +44,27 @@ namespace eosio { namespace chain {
3444
account_name sender;
3545
};
3646

47+
#define RESERVED_DUMMY_TX_EXT_CONTEXT(num) \
48+
struct reserved_dummy_transaction_extension_context_##num : fc::reflect_init { \
49+
static constexpr uint16_t extension_id() { return transaction_extension_id::reserved_tx_ext_id_##num; } \
50+
static constexpr bool enforce_unique() { return true; } \
51+
reserved_dummy_transaction_extension_context_##num() = default; \
52+
reserved_dummy_transaction_extension_context_##num( uint64_t dummy ) \
53+
:dummy( dummy ) {} \
54+
void reflector_init() {} \
55+
uint64_t dummy; \
56+
};
57+
58+
RESERVED_DUMMY_TX_EXT_CONTEXT(1)
59+
RESERVED_DUMMY_TX_EXT_CONTEXT(2)
60+
RESERVED_DUMMY_TX_EXT_CONTEXT(3)
61+
RESERVED_DUMMY_TX_EXT_CONTEXT(4)
62+
RESERVED_DUMMY_TX_EXT_CONTEXT(5)
63+
RESERVED_DUMMY_TX_EXT_CONTEXT(6)
64+
RESERVED_DUMMY_TX_EXT_CONTEXT(7)
65+
RESERVED_DUMMY_TX_EXT_CONTEXT(8)
66+
RESERVED_DUMMY_TX_EXT_CONTEXT(9)
67+
3768
namespace detail {
3869
template<typename... Ts>
3970
struct transaction_extension_types {
@@ -43,9 +74,18 @@ namespace eosio { namespace chain {
4374
}
4475

4576
using transaction_extension_types = detail::transaction_extension_types<
46-
deferred_transaction_generation_context,
47-
infrablockchain::chain::transaction_fee_payer_tx_ext,
48-
infrablockchain::chain::transaction_vote_tx_ext
77+
deferred_transaction_generation_context, // 0
78+
reserved_dummy_transaction_extension_context_1, // 1
79+
reserved_dummy_transaction_extension_context_2, // 2
80+
reserved_dummy_transaction_extension_context_3, // 3
81+
reserved_dummy_transaction_extension_context_4, // 4
82+
reserved_dummy_transaction_extension_context_5, // 5
83+
reserved_dummy_transaction_extension_context_6, // 6
84+
reserved_dummy_transaction_extension_context_7, // 7
85+
reserved_dummy_transaction_extension_context_8, // 8
86+
reserved_dummy_transaction_extension_context_9, // 9
87+
infrablockchain::chain::transaction_fee_payer_tx_ext, // 10
88+
infrablockchain::chain::transaction_vote_tx_ext // 11
4989
>;
5090

5191
using transaction_extension = transaction_extension_types::transaction_extension_t;
@@ -364,6 +404,15 @@ namespace eosio { namespace chain {
364404
} } /// namespace eosio::chain
365405

366406
FC_REFLECT(eosio::chain::deferred_transaction_generation_context, (sender_trx_id)(sender_id)(sender) )
407+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_1, (dummy) )
408+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_2, (dummy) )
409+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_3, (dummy) )
410+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_4, (dummy) )
411+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_5, (dummy) )
412+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_6, (dummy) )
413+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_7, (dummy) )
414+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_8, (dummy) )
415+
FC_REFLECT(eosio::chain::reserved_dummy_transaction_extension_context_9, (dummy) )
367416
FC_REFLECT( eosio::chain::transaction_header, (expiration)(ref_block_num)(ref_block_prefix)
368417
(max_net_usage_words)(max_cpu_usage_ms)(delay_sec) )
369418
FC_REFLECT_DERIVED( eosio::chain::transaction, (eosio::chain::transaction_header), (context_free_actions)(actions)(transaction_extensions) )

libraries/chain/include/infrablockchain/chain/exceptions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace infrablockchain { namespace chain {
5757
3712001, "Transaction includes an ill-formed transaction fee payer extension" )
5858

5959
FC_DECLARE_DERIVED_EXCEPTION( invalid_transaction_fee_payer_account, infrablockchain_transaction_fee_exception,
60-
3712002, "Invalid transaction fee payer Account name" )
60+
3712002, "Invalid transaction fee payer account name" )
6161

6262
// FC_DECLARE_DERIVED_EXCEPTION( invalid_tx_fee_setup_exception, infrablockchain_transaction_fee_exception,
6363
// 3712001, "Invalid transaction fee setup" )

libraries/chain/include/infrablockchain/chain/transaction_extensions.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ namespace infrablockchain { namespace chain {
1111

1212
using namespace eosio::chain;
1313

14-
enum transaction_extension_id {
15-
INFRABLOCKCHAIN_TRANSACTION_EXTENSION_ID_DELIMITER = 1024,
16-
infrablockchain_transaction_fee_payer_tx_ext_id, // 1025
17-
infrablockchain_transaction_vote_tx_ext_id // 1026
18-
};
14+
enum transaction_extension_id {
15+
infrablockchain_transaction_fee_payer_tx_ext_id = 10,
16+
infrablockchain_transaction_vote_tx_ext_id = 11
17+
18+
// @see eosio::chain::transaction_extension_id in eosio/chain/transaction.hpp
19+
};
1920

2021
/**
2122
* InfraBlockchain Transaction Fee Payer
@@ -55,11 +56,11 @@ namespace infrablockchain { namespace chain {
5556
* ],
5657
* "transaction_extensions": [
5758
* [
58-
* 1025,
59+
* 10,
5960
* "00c00257219de8ad"
6061
* ],
6162
* [
62-
* 1026,
63+
* 11,
6364
* "0011223344aabbcc"
6465
* ]
6566
* ],
@@ -111,7 +112,7 @@ namespace infrablockchain { namespace chain {
111112
* }
112113
* ],
113114
* "transaction_extensions": [[
114-
* 1026,
115+
* 11,
115116
* "00c00257219de8ad"
116117
* ]
117118
* ],

0 commit comments

Comments
 (0)