-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/runtime/client: Recheck failed blocks and implement max tx age
- Loading branch information
Showing
12 changed files
with
256 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
go/runtime/client: Runtime client should retry processing any failed blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
go/runtime/client: Wait for initial consensus block and group version | ||
|
||
Before, the runtime client would publish invalid messages before obtaining the | ||
initial group version. The messages were correctly retired upon receiving the | ||
group version, but this resulted in needless messages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
go/runtime/client: Add max transaction age | ||
|
||
Added `runtime.client.max_transaction_age` flag to configure number of | ||
consensus blocks after which a submitted runtime transaction is considered | ||
expired. Expired transactions are dropped by the client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
go/oasis-test-runner/scenario/e2e/runtime/client_expire.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package runtime | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/env" | ||
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/oasis" | ||
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/scenario" | ||
"github.com/oasisprotocol/oasis-core/go/runtime/client/api" | ||
) | ||
|
||
// ClientExpire is the ClientExpire node scenario. | ||
var ClientExpire scenario.Scenario = newClientExpireImpl("client-expire", "simple-keyvalue-client", nil) | ||
|
||
type clientExpireImpl struct { | ||
runtimeImpl | ||
} | ||
|
||
func newClientExpireImpl(name, clientBinary string, clientArgs []string) scenario.Scenario { | ||
return &clientExpireImpl{ | ||
runtimeImpl: *newRuntimeImpl(name, clientBinary, clientArgs), | ||
} | ||
} | ||
|
||
func (sc *clientExpireImpl) Clone() scenario.Scenario { | ||
return &clientExpireImpl{ | ||
runtimeImpl: *sc.runtimeImpl.Clone().(*runtimeImpl), | ||
} | ||
} | ||
|
||
func (sc *clientExpireImpl) Fixture() (*oasis.NetworkFixture, error) { | ||
f, err := sc.runtimeImpl.Fixture() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// Make client expire all transactions instantly. | ||
f.Clients[0].MaxTransactionAge = 1 | ||
|
||
return f, nil | ||
} | ||
|
||
func (sc *clientExpireImpl) Run(childEnv *env.Env) error { | ||
ctx := context.Background() | ||
|
||
// Start the network. | ||
var err error | ||
if err = sc.Net.Start(); err != nil { | ||
return err | ||
} | ||
|
||
// Wait for client to be ready. | ||
client := sc.Net.Clients()[0] | ||
nodeCtrl, err := oasis.NewController(client.SocketPath()) | ||
if err != nil { | ||
return err | ||
} | ||
if err = nodeCtrl.WaitReady(ctx); err != nil { | ||
return err | ||
} | ||
|
||
err = sc.submitKeyValueRuntimeInsertTx(ctx, runtimeID, "hello", "test") | ||
if !errors.Is(err, api.ErrTransactionExpired) { | ||
return fmt.Errorf("expected error: %v, got: %v", api.ErrTransactionExpired, err) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.