Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/reference/types/_includes/event_description.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Note that some events cannot be tagged with a Transaction ID:

### Reference, Topic and Correlator by Event Type

| Types | Reference | Topic | Correlator |
|---------------------------------------------|--------------------------------------|-----------------------------|-------------------------|
| Types | Reference | Topic | Correlator |
|---------------------------------------------|-------------------------------------------|-----------------------------|-------------------------|
| `transaction_submitted` | [Transaction](./transaction.html) | `transaction.type` | |
| `message_confirmed`<br/>`message_rejected` | [Message](./message.html) | `message.header.topics[i]`* | `message.header.cid` |
| `token_pool_confirmed` | [TokenPool](./tokenpool.html) | `tokenPool.id` | |
Expand All @@ -90,6 +90,8 @@ Note that some events cannot be tagged with a Transaction ID:
| `blockchain_event_received` | [BlockchainEvent](./blockchainevent.html) | From listener ** | |
| `blockchain_invoke_op_succeeded` | [Operation](./operation.html) | | |
| `blockchain_invoke_op_failed` | [Operation](./operation.html) | | |
| `blockchain_contract_deploy_op_succeeded` | [Operation](./operation.html) | | |
| `blockchain_contract_deploy_op_failed` | [Operation](./operation.html) | | |

> * A separate event is emitted for _each topic_ associated with a [Message](./message.html).

Expand Down
23 changes: 7 additions & 16 deletions internal/blockchain/ethereum/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type Ethereum struct {
capabilities *blockchain.Capabilities
callbacks common.BlockchainCallbacks
client *resty.Client
fftmClient *resty.Client
streams *streamManager
streamID string
wsconn wsclient.WSClient
Expand Down Expand Up @@ -132,7 +131,6 @@ func (e *Ethereum) Init(ctx context.Context, cancelCtx context.CancelFunc, conf
e.InitConfig(conf)
ethconnectConf := e.ethconnectConf
addressResolverConf := conf.SubSection(AddressResolverConfigKey)
fftmConf := conf.SubSection(FFTMConfigKey)

e.ctx = log.WithLogField(ctx, "proto", "ethereum")
e.cancelCtx = cancelCtx
Expand All @@ -152,10 +150,6 @@ func (e *Ethereum) Init(ctx context.Context, cancelCtx context.CancelFunc, conf
}
e.client = ffresty.New(e.ctx, ethconnectConf)

if fftmConf.GetString(ffresty.HTTPConfigURL) != "" {
e.fftmClient = ffresty.New(e.ctx, fftmConf)
}

e.topic = ethconnectConf.GetString(EthconnectConfigTopic)
if e.topic == "" {
return i18n.NewError(ctx, coremsgs.MsgMissingPluginConfig, "topic", "blockchain.ethereum.ethconnect")
Expand Down Expand Up @@ -569,12 +563,8 @@ func (e *Ethereum) invokeContractMethod(ctx context.Context, address, signingKey
if err != nil {
return err
}
client := e.fftmClient
if client == nil {
client = e.client
}
var resErr ethError
res, err := client.R().
res, err := e.client.R().
SetContext(ctx).
SetBody(body).
SetError(&resErr).
Expand Down Expand Up @@ -706,17 +696,18 @@ func (e *Ethereum) DeployContract(ctx context.Context, nsOpID, signingKey string
return err
}

client := e.fftmClient
if client == nil {
client = e.client
}
var resErr ethError
res, err := client.R().
res, err := e.client.R().
SetContext(ctx).
SetBody(body).
SetError(&resErr).
Post("/")
if err != nil || !res.IsSuccess() {
if strings.Contains(string(res.Body()), "FFEC100130") {
// This error is returned by ethconnect because it does not support deploying contracts with this syntax
// Return a more helpful and clear error message
return i18n.NewError(ctx, coremsgs.MsgNotSupportedByBlockchainPlugin)
}
return wrapError(ctx, &resErr, res, err)
}
return nil
Expand Down
2 changes: 0 additions & 2 deletions internal/blockchain/ethereum/ethereum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ func TestInitAndStartWithEthConnect(t *testing.T) {
cmi.On("GetCache", mock.Anything).Return(cache.NewUmanagedCache(e.ctx, 100, 5*time.Minute), nil)
err := e.Init(e.ctx, e.cancelCtx, utConfig, e.metrics, cmi)
assert.NoError(t, err)
assert.NotNil(t, e.fftmClient)

assert.Equal(t, "ethereum", e.Name())
assert.Equal(t, core.VerifierTypeEthAddress, e.VerifierType())
Expand Down Expand Up @@ -258,7 +257,6 @@ func TestInitAndStartWithFFTM(t *testing.T) {
cmi.On("GetCache", mock.Anything).Return(cache.NewUmanagedCache(e.ctx, 100, 5*time.Minute), nil)
err := e.Init(e.ctx, e.cancelCtx, utConfig, e.metrics, cmi)
assert.NoError(t, err)
assert.NotNil(t, e.fftmClient)

assert.Equal(t, "ethereum", e.Name())
assert.Equal(t, core.VerifierTypeEthAddress, e.VerifierType())
Expand Down