Repository: protolambda/remerkleable

Issue:
Check if the field name is valid when initialize a Container object
### Issue
Currently, the following call is valid:

```sh
>>> from eth2spec.phase0 import spec
>>> x = spec.AttestationData(bar=1000)
>>> x
AttestationData(Container)
    slot: Slot = 0
    index: CommitteeIndex = 0
    beacon_block_root: Root = 0x0000000000000000000000000000000000000000000000000000000000000000
    source: Checkpoint = Checkpoint(Container)
                             epoch: Epoch = 0
                             root: Root = 0x0000000000000000000000000000000000000000000000000000000000000000
    target: Checkpoint = Checkpoint(Container)
                             epoch: Epoch = 0
                             root: Root = 0x0000000000000000000000000000000000000000000000000000000000000000
```

 I suppose it should have thrown an exception since `bar` is not a valid field in `AttestationData`. 

### How to solve it
Add check in `Container.__new__`
```python
        diff = set(kwargs.keys()).difference(set(fields.keys()))
        if len(diff) > 0:
            raise Exception(f'The field name {diff} is not defined in {cls}')
```

Discussion:

Patch:
diff --git a/remerkleable/complex.py b/remerkleable/complex.py
index c92fa0c..e65160f 100644
--- a/remerkleable/complex.py
+++ b/remerkleable/complex.py
@@ -668,8 +668,12 @@ class Container(ComplexView):
                 raise Exception("cannot have both a backing and elements to init List")
             return super().__new__(cls, backing=backing, hook=hook, **kwargs)
 
+        diff = set(kwargs.keys()).difference(set(cls.fields().keys()))
+        if len(diff) > 0:
+            raise AttributeError(f'The field names {diff} are not defined in {cls}')
+
         input_nodes = []
-        for i, (fkey, ftyp) in enumerate(cls.fields().items()):
+        for fkey, ftyp in cls.fields().items():
             fnode: Node
             if fkey in kwargs:
                 finput = kwargs.pop(fkey)


Test patch:
diff --git a/remerkleable/test_typing.py b/remerkleable/test_typing.py
index 87fed19..dd20833 100644
--- a/remerkleable/test_typing.py
+++ b/remerkleable/test_typing.py
@@ -164,6 +164,12 @@ def test_container():
     except AttributeError:
         pass
 
+    try:
+        Foo(wrong_field_name=100)
+        assert False
+    except AttributeError:
+        pass
+
 
 def test_container_unpack():
     class Foo(Container):