Skip to content

Commit a0a2df5

Browse files
committed
fix: since we don't simulate, make sure our gas estimate is good
1 parent c6bf0e2 commit a0a2df5

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed

packages/agoric-cli/lib/start.js

-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
450450
'--keyring-backend=test',
451451
'--from=provision',
452452
'--gas=auto',
453-
'--gas-adjustment=1.5',
454453
'--broadcast-mode=block',
455454
'--yes',
456455
`--chain-id=${CHAIN_ID}`,

packages/cosmic-swingset/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ t1-provision-one-with-powers:
9999
addr=$$(cat t1/$(BASE_PORT)/ag-cosmos-helper-address); \
100100
$(AGCH) --home=t1/bootstrap query swingset egress $$addr --chain-id=$(CHAIN_ID) || \
101101
$(AGCH) --home=t1/bootstrap tx swingset provision-one --keyring-backend=test --from=bootstrap \
102-
--gas=auto --gas-adjustment=1.4 --broadcast-mode=block --yes --chain-id=$(CHAIN_ID) \
102+
--gas=auto --broadcast-mode=block --yes --chain-id=$(CHAIN_ID) \
103103
t1/$(BASE_PORT) $$addr agoric.vattp | tee /dev/stderr | grep -q 'code: 0'
104104

105105
t1-provision-one:
106106
addr=$$(cat t1/$(BASE_PORT)/ag-cosmos-helper-address); \
107107
$(AGCH) --home=t1/bootstrap query swingset egress $$addr --chain-id=$(CHAIN_ID) || \
108108
$(AGCH) --home=t1/bootstrap tx swingset provision-one --keyring-backend=test --from=bootstrap \
109-
--gas=auto --gas-adjustment=1.4 --broadcast-mode=block --yes --chain-id=$(CHAIN_ID) \
109+
--gas=auto --broadcast-mode=block --yes --chain-id=$(CHAIN_ID) \
110110
t1/$(BASE_PORT) $$addr | tee /dev/stderr | grep -q 'code: 0'
111111

112112
# Actually start the ag-solo.

packages/cosmic-swingset/lib/ag-solo/chain-cosmos-sdk.js

-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ ${chainID} chain does not yet know of address ${myAddr}${adviseProvision(
421421
'--keyring-backend=test',
422422
`@${tmpInfo.path}`, // Deliver message over file, as it could be big.
423423
'--gas=auto',
424-
'--gas-adjustment=1.05',
425424
'--from=ag-solo',
426425
'-ojson',
427426
'--broadcast-mode=block', // Don't return until committed.

packages/cosmic-swingset/x/swingset/handler.go

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ func NewHandler(keeper Keeper) sdk.Handler {
3131
if committedHeight == ctx.BlockHeight() {
3232
// We don't support simulation.
3333
return &sdk.Result{}, nil
34+
} else {
35+
// The simulation was done, so now allow infinite gas.
36+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
3437
}
3538

3639
switch msg := msg.(type) {

packages/cosmic-swingset/x/swingset/ibc.go

+27
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ func (am AppModule) OnChanOpenInit(
199199
if committedHeight == ctx.BlockHeight() {
200200
// We don't support simulation.
201201
return nil
202+
} else {
203+
// The simulation was done, so now allow infinite gas.
204+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
202205
}
203206

204207
event := channelOpenInitEvent{
@@ -260,6 +263,9 @@ func (am AppModule) OnChanOpenTry(
260263
if committedHeight == ctx.BlockHeight() {
261264
// We don't support simulation.
262265
return nil
266+
} else {
267+
// The simulation was done, so now allow infinite gas.
268+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
263269
}
264270

265271
event := channelOpenTryEvent{
@@ -313,6 +319,9 @@ func (am AppModule) OnChanOpenAck(
313319
if committedHeight == ctx.BlockHeight() {
314320
// We don't support simulation.
315321
return nil
322+
} else {
323+
// The simulation was done, so now allow infinite gas.
324+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
316325
}
317326

318327
event := channelOpenAckEvent{
@@ -351,6 +360,9 @@ func (am AppModule) OnChanOpenConfirm(
351360
if committedHeight == ctx.BlockHeight() {
352361
// We don't support simulation.
353362
return nil
363+
} else {
364+
// The simulation was done, so now allow infinite gas.
365+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
354366
}
355367

356368
event := channelOpenConfirmEvent{
@@ -389,6 +401,9 @@ func (am AppModule) OnChanCloseInit(
389401
if committedHeight == ctx.BlockHeight() {
390402
// We don't support simulation.
391403
return nil
404+
} else {
405+
// The simulation was done, so now allow infinite gas.
406+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
392407
}
393408

394409
event := channelCloseInitEvent{
@@ -426,6 +441,9 @@ func (am AppModule) OnChanCloseConfirm(
426441
if committedHeight == ctx.BlockHeight() {
427442
// We don't support simulation.
428443
return nil
444+
} else {
445+
// The simulation was done, so now allow infinite gas.
446+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
429447
}
430448

431449
event := channelCloseConfirmEvent{
@@ -461,6 +479,9 @@ func (am AppModule) OnRecvPacket(
461479
if committedHeight == ctx.BlockHeight() {
462480
// We don't support simulation.
463481
return &sdk.Result{}, nil
482+
} else {
483+
// The simulation was done, so now allow infinite gas.
484+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
464485
}
465486

466487
// Sometimes we receive duplicate packets, just with a
@@ -511,6 +532,9 @@ func (am AppModule) OnAcknowledgementPacket(
511532
if committedHeight == ctx.BlockHeight() {
512533
// We don't support simulation.
513534
return &sdk.Result{}, nil
535+
} else {
536+
// The simulation was done, so now allow infinite gas.
537+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
514538
}
515539

516540
event := acknowledgementPacketEvent{
@@ -552,6 +576,9 @@ func (am AppModule) OnTimeoutPacket(
552576
if committedHeight == ctx.BlockHeight() {
553577
// We don't support simulation.
554578
return &sdk.Result{}, nil
579+
} else {
580+
// The simulation was done, so now allow infinite gas.
581+
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
555582
}
556583

557584
event := timeoutPacketEvent{

packages/deployment/ansible/roles/cosmos-genesis/files/faucet-helper.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ while [[ ${#rpcAddrs[@]} -gt 0 ]]; do
3131
exec ag-cosmos-helper --home=$FAUCET_HOME \
3232
tx swingset provision-one \
3333
--node=tcp://$selected --chain-id=$chainName \
34-
--yes --gas=auto --gas-adjustment=1.5 --broadcast-mode=block \
34+
--yes --gas=auto --broadcast-mode=block \
3535
--from=faucet -- "$NAME" "$ADDR"
3636
;;
3737
add-delegate)
@@ -66,7 +66,7 @@ while [[ ${#rpcAddrs[@]} -gt 0 ]]; do
6666
if ag-cosmos-helper --home=$FAUCET_HOME \
6767
tx send \
6868
--node=tcp://$selected --chain-id=$chainName \
69-
--yes --gas=auto --gas-adjustment=1.5 --broadcast-mode=block \
69+
--yes --gas=auto --broadcast-mode=block \
7070
-- faucet "$ADDR" "$STAKE"; then
7171
# Record the information before exiting.
7272
sed -i -e "/:$NAME$/d" $thisdir/cosmos-delegates.txt

0 commit comments

Comments
 (0)