-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Unit test] role based key fee payer #59
base: dev
Are you sure you want to change the base?
[Unit test] role based key fee payer #59
Conversation
…d key, test case 3,4
// 4) RLP Decoding | ||
const { KlaytnTxFactory } = require("@kaiachain/web3js-ext"); | ||
const decoded = KlaytnTxFactory.fromRLP(signedTxByFeePayer.rawTransaction); | ||
console.log("Decoded Transaction:", decoded); |
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.
@kjeom
[What I Tried]
- Decoding (RLP) to Verify FeePayer Address
- I attempted to check whether the actual FeePayer address matches my intended address by using KlaytnTxFactory.fromRLP(...) after signing the transaction twice (User first, then roleFeePayerAccount).
- Once both signatures were complete, I decoded the final raw transaction, expecting to see the FeePayer field populated with my intended FeePayer address.
- Observation
- However, after decoding, I found that the feePayer field was empty, suggesting that the FeePayer signature wasn’t reflected in the final transaction.
[Question]
“If the feePayer field is empty in the decoded transaction, does that imply our two-step signing process is incorrect, or could there be a bug in how web3js-ext handles RoleBased FeePayer signatures?”
More specifically:
- I called signTransaction twice (User → FeePayer), providing all necessary fields (type, from, to, value, gasLimit, gasPrice, nonce, chainId, feePayer, and senderRawTransaction).
- Despite both signings appearing to succeed, the decoded result shows no FeePayer data.
[Additional Notes]
- This issue arises when using RoleBased accounts for FeeDelegated transactions. Even though the second signing step looks successful (i.e., I get a new raw transaction), the final RLP does not contain the feePayer field.
- I'm curious if this is related to a known RoleBased + FeeDelegated limitation or bug in web3js-ext...?
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.
@minminkikiki Could you send the transaction to the network? and check whether the actual feePayer's address is the role-based account's address.
In this case, you need to make the account like following
legacy A : address A - private Key A
legacy B : address B - private Key B
role based C : address A - transaction key A, fee payer key B
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.
@kjeom I tried it as you told me, and the results are as follows.
legacy A(0x32e62d71311974a1c9e5f723c1750fa85d8a5b76) : address A - private Key A
legacy B(0x399294d64984a33cd30ddae0932df89c414941c4) : address B - private Key B
role based C : address A - transaction key A, fee payer key B
(legacy A/B were created using the kaia online tooklit for sending actual transactions)
[Expected Behavior]
- Account Update: After updating legacyA to a RoleBased account, its RoleTransaction key is set to legacyA’s private key, and its RoleFeePayer key is set to legacyB’s private key. The account’s address remains legacyA.
- FeeDelegated Transaction: When a FeeDelegatedValueTransfer transaction is sent:
The transaction is first signed by legacyA (for the transaction data).
Then it is signed by legacyB (for fee delegation), with the feePayer field set to legacyA’s address. - Final Outcome: The final transaction should show:
The from field (and ideally the feePayer field) as legacyA’s address.
The transferred value deducted from legacyA’s balance, and the gas fee paid by legacyB.
[Actual Behavior Observed]
- The Account Update and Transaction fields correctly show legacyA’s address.
- However, the feePayer field is either missing or does not match legacyA’s address.
- In some observations (via Scope Explorer), the feePayer field appears as an entirely different address (e.g., 0x54aef27ee84655cdaac7926bf28aff333a7c4d7a), which is neither legacyA(0x32e62d71311974a1c9e5f723c1750fa85d8a5b76) nor legacyB(0x399294d64984a33cd30ddae0932df89c414941c4).
- This suggests that the Role-Based Key mechanism is not correctly applying the fee delegation, potentially due to a bug in the signing or transaction construction process.
[Conclusion]
- The feePayer field is not being correctly populated with legacyA’s address (the RoleBased account), and an unexpected or missing feePayer value is observed.
…e role-based account's address
Test Overview
Reference
Understanding of the author, about Role-based Key
(If there was a misunderstanding, the test case itself could be wrong....)
(e.g RoleAccountUpdate(Role) : AccountUpdate(TxType)
RoleTransaction(Role) : ValueTransfer(TxType))
Test Cases
Test Results
Test Bug?