Skip to content

Commit ac0519b

Browse files
authored
[price-pusher] Bugfix in handling account sequence mismatch (#1028)
account sequence mismatch error could happen in the simulation but the try catch did not cover that part Verified the fix by manually incrementing the sequence number twice after each transaction so a refetch was necessary
1 parent 78ca49d commit ac0519b

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

price_pusher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-pusher",
3-
"version": "5.4.8",
3+
"version": "5.4.9",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

price_pusher/src/injective/injective.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -133,37 +133,37 @@ export class InjectivePricePusher implements IPricePusher {
133133

134134
const txService = new TxGrpcClient(this.grpcEndpoint);
135135
// simulation
136-
const {
137-
gasInfo: { gasUsed },
138-
} = await txService.simulate(simulateTxRaw);
136+
try {
137+
const {
138+
gasInfo: { gasUsed },
139+
} = await txService.simulate(simulateTxRaw);
139140

140-
// simulation returns us the approximate gas used
141-
// gas passed with the transaction should be more than that
142-
// in order for it to be successfully executed
143-
// this multiplier takes care of that
144-
const gas = (gasUsed * this.chainConfig.gasMultiplier).toFixed();
145-
const fee = {
146-
amount: [
147-
{
148-
denom: "inj",
149-
amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(),
150-
},
151-
],
152-
gas,
153-
};
141+
// simulation returns us the approximate gas used
142+
// gas passed with the transaction should be more than that
143+
// in order for it to be successfully executed
144+
// this multiplier takes care of that
145+
const gas = (gasUsed * this.chainConfig.gasMultiplier).toFixed();
146+
const fee = {
147+
amount: [
148+
{
149+
denom: "inj",
150+
amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(),
151+
},
152+
],
153+
gas,
154+
};
154155

155-
const { signBytes, txRaw } = createTransactionFromMsg({
156-
sequence: this.account.baseAccount.sequence,
157-
accountNumber: this.account.baseAccount.accountNumber,
158-
message: msg,
159-
chainId: this.chainConfig.chainId,
160-
fee,
161-
pubKey: this.wallet.toPublicKey().toBase64(),
162-
});
156+
const { signBytes, txRaw } = createTransactionFromMsg({
157+
sequence: this.account.baseAccount.sequence,
158+
accountNumber: this.account.baseAccount.accountNumber,
159+
message: msg,
160+
chainId: this.chainConfig.chainId,
161+
fee,
162+
pubKey: this.wallet.toPublicKey().toBase64(),
163+
});
163164

164-
const sig = await this.wallet.sign(Buffer.from(signBytes));
165+
const sig = await this.wallet.sign(Buffer.from(signBytes));
165166

166-
try {
167167
this.account.baseAccount.sequence++;
168168

169169
/** Append Signatures */

0 commit comments

Comments
 (0)